What is the correct type for serializing Maybe
types?
Given I have some data structure of Maybe
type on the server and I serialize it with showToFay
function, then it won't become one of the {"instance":"Nothing"}
or {"instance":"Maybe","slot1":<actual_value>}
, but it is serialized as either null
or bare inside of the Just
. Then it's not possible for me to deserialize it on the client correctly.
I'm using the data MyMaybe a = MyNothing | MyJust a
type for now, but it's hard to do with as I need to pattern match all the time and I can't use the combinators defined on Maybe
.