[Haskell-cafe] Over general types are too easy to make.
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) , which
provides an approach to constructing "open" data types (i.e., sum types to
which new summands can be added)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe