[Haskell-cafe] Why aren't there anonymous sum types in Haskell?

pipoca eliyahu.ben.miney at gmail.com
Tue Jun 21 23:24:16 CEST 2011


On Jun 21, 4:57 pm, Alexey Khudyakov <alexey.sklad... at gmail.com>
wrote:
> Types may be same.
>
> oops :: Int :+: Int -> Int
> oops <Int i> = mmm which one?

If you were to have your anonymous sum types be a union instead of the
disjoint union, then you could say that A :+: A has no meaning.
That's what I was originally thinking of when I suggested that
syntax.  However, as was pointed out to me by David Sankel, disjoint
unions are more powerful than regular unions.  Since that's the case,
Matthew Steele's suggested syntax makes more sense.  It means that you
need to remember the order of your arguments, but you need to do that
with tuples, anyway.




More information about the Haskell-Cafe mailing list