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