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