Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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
    }


Arbitrary 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/Re...

You have a bool which specifies whether it's left or right, and then two payloads, one for left and one for right.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: