[Haskell-cafe] Over general types are too easy to make.
Alexander Solla
alex.solla at gmail.com
Sun Sep 2 19:06:04 CEST 2012
On Sun, Sep 2, 2012 at 9:40 AM, <timothyhobbs at seznam.cz> wrote:
> The thing is, that one ALWAYS wants to create a union of types, and not
> merely an ad-hock list of data declarations. So why does it take more code
> to do "the right thing(tm)" than to do "the wrong thing(r)"?
>
Because a union type is a complex union of parts, and the parts need to be
deconstructed in order to be acted upon. There is not a unique way to do
this -- different "unwrappings" have different properties and must match
your use case.
Perhaps you should read "Data types ala carte" (W. Swiestra) [1], which
provides an approach to constructing "open" data types (i.e., sum types to
which new summands can be added)
[1] http://www.cs.ru.nl/~W.Swierstra/Publications/DataTypesALaCarte.pdf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120902/ce7e2512/attachment.htm>
More information about the Haskell-Cafe
mailing list