Now, to round it back to your question: the class...
# arrow
p
Now, to round it back to your question: the class Json can’t map internal values from
A -> B
, so you can’t implement the interface
Functor
for it. You can try, but the types most probably won’t “align”. If you just want the simplest possible wrapper, one that’s not like
Option
or
List
, it’s just a dumb box, we have
Id
. So,
Id(deserialize()).map(::serialize).value
works pretty much the same as
deserialize().let(::serialize)
. The difference that
Id
has the interface hierarchy defined up to
Monad
, at the cost of the memory used by the
Id
wrapper and the stupid packing and unpacking to use it.