>>  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:

http://personal.cis.strath.ac.uk/~conor/pub/she

> 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:

http://www.cs.ru.nl/~wouters/Publications/DataTypesALaCarte.pdf
http://people.cs.uu.nl/andres/OpenDatatypes.html

Cheers,
  Andres

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to