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

David Barbour dmbarbour at gmail.com
Wed Jun 22 01:48:29 CEST 2011


On Tue, Jun 21, 2011 at 2:24 PM, pipoca <eliyahu.ben.miney at gmail.com> wrote:

> 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 sort of union would not be parametric, and would play havoc with
generic programming.

E.g. consider taking a list [(t,Int)] and [(t,a)] and generating a list of
[(t,Int :+: a)], then processing this with a function of the form Int ->
Bool.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110621/eeda3fd7/attachment.htm>


More information about the Haskell-Cafe mailing list