[Haskell-cafe] Data constructor synonyms

Yves Parès limestrael at gmail.com
Fri Mar 18 14:48:27 CET 2011


You are better to use simple typeclasses. It depends on what you are trying
to do, but when I want an open type, I use classes + type families.


2011/3/18 Stephen Tetley <stephen.tetley at gmail.com>

> On 18 March 2011 13:31, Grigory Sarnitskiy <sargrigory at ya.ru> wrote:
>
> > Anyway, a new question arose.  If I have already declared a type, can I
> add new constructors to it from other modules?
> >
> > Maybe there are some GHC extensions to solve both these problems.
>
> "no can do".
>
> There are ways to encode extensible types (e.g the "finally tagless"
> sytle), but on balance you are better to design extensibility for
> functions - easy to add more functions - than make your code much more
> complicated so it can be extensible for types.
>
> Parser combinators and pretty print combinators are great and largely
> simple examples of extensibility with functions.
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110318/8de2702f/attachment.htm>


More information about the Haskell-Cafe mailing list