4 ms·
Ok, this is for a Maybe/Option, but can't see how can work for any algebraic type. I have this for mine: struct Ag { tag :String, //like "Option.N
by mamcx 5y ago
Ok, this is for a Maybe/Option, but can't see how can work for any algebraic type.
I have this for mine:
struct Ag {
tag :String, //like "Option.None"
data:Vec<Value> //The data inside, if any
}
- tome 5y agoArbitrary sum types are just a generalisation of what I wrote. Opaleye doesn't have them (yet?) but rel8 does: https://hackage.haskell.org/package/rel8-1.1.0.0/docs/src/Rel8.Table.Either.html#EitherTable https://hackage.haskell.org/package/rel8-1.1.0.0/docs/src/Re... You have a bool which specifies whether it's left or right, and then two payloads, one for left and one for right.