[Haskell-cafe] Why aren't there anonymous sum types in Haskell?
Casey McCann
syntaxglitch at gmail.com
Wed Jun 22 00:54:17 CEST 2011
On Tue, Jun 21, 2011 at 5:24 PM, pipoca <eliyahu.ben.miney at gmail.com> wrote:
> 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.
Of course, the same idea could be applied to tuples as well. An
"anonymous product" A :*: B would be a collection with no defined
order for its elements, indexed by type instead of position. A :*: A
would be meaningless for similar reasons to A :+: A.
That said, I don't think either retains the tidy algebraic properties
that disjoint unions and tuples have, so I'm not sure if calling them
sums and products is actually correct.
- C.
More information about the Haskell-Cafe
mailing list