[Haskell-cafe] Why is the no tuple syntax for sum types

Silvio Frischknecht silvio.frischi at gmail.com
Thu Jul 30 15:00:54 UTC 2015


Protuct types have this nice tuple syntax (a,Char,Int),(a,'c',1). Why is
there no syntax like this for Sum types (a|Char|Int),(||1). This would
be very usefull for some more explicit error handling. I.E.

You have a library that has errors.

Error1, .. ErrorN.

Currently there are only two ways of making a function that can throw
Error3 and Error8.

Use 'Dynamic' typed Exceptions or make a general Error type that is the
sum of all Errors. In both cases it is not clear from the type of the
function what Errors can occur.

With sumTuples you could just return (Result|Error3|Error8).

Also, I guess I'm just one of those people who occasionally confuse Left
and Right :)

Silvio Frischknecht


More information about the Haskell-Cafe mailing list