You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order to behave more like flow-static-land which doesn't change the underline representation when you call inj / prj, would be useful a toNullable function
The problem I faced is that - while the .toJSON solves the serialisation - there's no easy way to
deserialise the data structure.
As an example, I'm using a redux-like framework and messages and state are plain objects by definition. When I wrapped my Maybes into classes, I had to have ser/deser functions all over codebase. This made the code more complicated and bloated.
For data types such as Maybe and Either, it makes sense to have the data type as a plain object. In that way there's no need to transform the data into the proper data type.
This is what I get from
Option
nowIn order to behave more like flow-static-land which doesn't change the underline representation when you call
inj / prj
, would be useful atoNullable
functionsuch that the pair
inj / prj
is equivalent to the pairfromNullable / toNullable
. Also bothNone
andSome
could implement thetoJSON
method.Proof of concept
Result
/cc @danielepolencic
The text was updated successfully, but these errors were encountered: