I'm using cmdargs
to get some arguments from a command line program. I'm using some special type in my program
data Function = Max
| Min
| Moy
| Med
deriving (Eq,Data,Typeable)
I can pass these types directly in arguments with "Max" "Min" "Moy" "Med"
by deriving the Function
datatype in the classes Data
and Typeable
. My problem is my program is becoming more complex and I need to rename my constructor to avoid name collisions.
data Function = funMax
| funMin
| funMoy
| funMed
deriving (Eq,Data,Typeable)
However, I would like to keep accessing these constructor with "Max" "Min" "Moy" "Med"
. To do that, I suppose I need to create my own Data
and Typeable
Instances of Function
, is that right ?
My problem is I didn't manage to create these instance even after reading the Hackage documentation.
Have you ever succesfully created Data
and Typeable
instances of your own data type?