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

pipoca eliyahu.ben.miney at gmail.com
Tue Jun 21 22:32:46 CEST 2011

On Jun 21, 4:15 pm, Alexander Solla <alex.so... at gmail.com> wrote:
> The problem is that a sum type must "name" the different types, or else it
> can't give access to them.  How is a function supposed to know if a value
> blah :: A :+: B
> is an A or a B?  It seems possible that it could figure it out, but that
> problem is undecidable in general.

Why can't you use pattern matching?  We'd probably want to change the
syntax a little, to tell Haskell that we want to use an anonymous sum.

Something like:

foo :: Bar :+: Baz -> Quux
foo <Bar bar> = ...
foo <Baz baz> = ...

Would finding the type signature of foo be undecidable?

More information about the Haskell-Cafe mailing list