[MLton-user] Wish for a standard sum type

Vesa Karvonen vesa.karvonen@cs.helsinki.fi
Mon, 29 May 2006 20:16:10 +0300


Quoting Andreas Rossberg <AndreasRossberg@web.de>:
> For the Alice library we chose
> 
>   datatype ('a,'b) alt = FST of 'a | SND of 'b
> 
> although I'm not particularly excited about it. It has the advantage that it
> is less likely to collide with user datatype constructors.  (However, I
> always disliked "either" as a type name, and it reads even worse in postfix
> notation ;-) )

FST|SND is not too bad.  I can't say that I like "alt".  How about "sum"?

> I'm not too fond of THIS/THAT, because they do not look properly symmetric
> to me.

I agree.  I just tried using them (for the first time) and they look too
similar.

> Regarding casing, I believe that uppercase constructors are actually
> prescribed by the Basis Spec: it suggests the "signature convention" for
> ordinary constructors, and the "structure convention" for exception
> constructors. Can't say I ever liked that either, though...

Well, I didn't like the upper case constructors at first either, but
now I've gotten used to them.  However, if I could magically change
it, I'd probably choose the "structure convention" for constructors.

-Vesa Karvonen