Looks like traceAny :: a -> Effect Unit
was added to this library awhile ago, then later removed.
Some arguments against that type signature:
It violates free theorem which says it ignores its argument
Implementations not violating such derived theorems is generally assumed of APIs
For example:
f :: forall a b. Tuple a b -> Tuple b a
swaps the elements of the tuple given
f :: forall a. List a -> List a
all elements in the output also exist in the input
f :: forall a b. a -> List b
ignores its argument and returns the empty list
Itβs something you can say about a (polymorphic) function given only its type
@rightfold
There's also the argument that it's possibly not referentially transparent.
I think it should exist here, though, in some form.
The console.log
docs on MDN says it accepts any JS object. All PS types are JS objects at runtime, so we could say that a -> Effect Unit
is a good description.
On the other hand, we could describe it as Json -> Effect Unit
, where Json
is a type which represents a data structure of "idiomatic primitive JSON types" in JavaScript, like plain-old objects (not classes), arrays, numbers, and strings.
We could do a constraint on a
and implement that constraint like justinwoo/simple-json did: Json a => a -> Effect Unit
.