-
Couldn't load subscription status.
- Fork 669
Closed
Description
This seems pretty simple to implement:
data Foo a = Bar String
| Baz (Foo a) Int
x = Bar "bleh"
y = Baz x 7then x and y could be serialized to the following javascript (field names could easily be something else):
var x = { _ctor: "Bar", _0: "bleh" }
var y = { _ctor: "Baz", _0: x, _1: 7 }The only problem I see with this is that the serialization of Maybe would be inconsistent with this.
Right now it's actually impossible to serialize a Sum type. Even if we're unsure about doing this in general, we definitely need to at least support the Either type. Currently I'm doing the following to get around this limitation
type Either' a b = (Maybe a, Maybe b)where I ignore the 2nd value if the first one is non-null, but this is obviously suboptimal.
MichaelSnowden