pakoito
09/11/2018, 11:33 PMA -> 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.