[Haskell-cafe] Data constructor synonyms
sargrigory at ya.ru
Fri Mar 18 11:58:36 CET 2011
Hello! Assume I have a type MyType with the constructor GeneralConstructor:
data MyType = GeneralConstructor [Double]
but I also want to have a separate name for special case of this constructor:
so SpecialConstructor a = GeneralConstructor (a:) that is
SpecialConstructor 5 was exactly the same as GeneralConstructor .
And for example instead of writing GeneralConstructor  I would like to use constructor Zero. It's all just for convenience.
How can I achieve this? Well, of course I always can use sed to replace SpecialConstructor 5 with GeneralConstructor  in program sources, but it's not convenient.
More information about the Haskell-Cafe