Haskell, Coq and Agda all have algebraic datatypes. How do they do it ?
I'm pretty sure they have a mix of: - don't treat modules as datatypes - special case the single-alternative datatype (aka "record").
Because Stefan’s solution is not very user-friendly if we have to write the Either datatype like that.
You'd use a macro to hide the boilerplate.
Plus if a macro can do the conversion, so should the compiler before generating intermediate code.
Not sure what you mean.
We also have to think about the macros. What would a programmer expect when receiving code with a “case” in it.
Same here.
Stefan