On 18 March 2011 13:31, Grigory Sarnitskiy <[email protected]> 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
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to