[Haskell-cafe] Data constructor synonyms

Andres Loeh andres.loeh at googlemail.com
Fri Mar 18 14:44:11 CET 2011

>>  Remember that constructors are functions, except that you can't
>>  pattern match against them.
> ..
>>  The downside is that you can't pattern-match against these functions.
> The thing is that I need pattern matching, just functions won't do.

It's "only" a preprocessor, but Conor's "she" allows pattern synonyms:


> Anyway, a new question arose.  If I have already declared a type, can I add new constructors to it from other modules?

Again, not within Haskell itself. "she" also has a feature that allows
something like this. There are various other techniques or proposals.
For example:



More information about the Haskell-Cafe mailing list