I don't know Haskell, but looking quickly that's more like Rust's "Option" which is in std library, built using the odd "enum"
2
yeah, so Haskell Either seems to be more like Rust's language feature "enum" (only enum can take more than 2 choices...)
1
yes! which I guess is a really generic way of thinking about an enum... rustbyexample.com/custom_typ…
1
I'm not convinced. It sounds like a Haskell algebraic data type. Enums should be able to enumerate all their possible values.
2
I agree. Sounds like Tagged Union en.wikipedia.org/wiki/Tagged… (aka "datatype" in ML)
1
Aye, though one colleague here argues that "since in C you tend to use enums for that, it's perhaps not an awful name"
1
that's pretty fair.
2
enums in C are weird. You can't enumerate their members; you can't determine their compatible type. We banned them.
1
1
Replying to @drjtwit @frabcus
Most "types" in C are basically voluntary documentation rather than actual types :-/

Aug 2, 2016 Β· 9:59 AM UTC

1
1
haha. True dat. enum types seemed particularly bad though.