title: Converting enumerations to int-like types in haskell
body: <p>I was following the advice on Haskell's Wiki page: <a href="http://www.haskell.org/haskellwiki/Performance/Data_types" rel="nofollow">Performance/Data types</a> to improve the performance of my code, but when I changed </p>
  
  <pre><code>data Color = Yellow | Red | Green | Blue | Empty deriving (Show, Eq)
  </code></pre>
  
  <p>to</p>
  
  <pre><code>newtype Color = Color Int deriving (Eq,Ord,Enum) 
  (yellow:red:green:blue:empty:_) = [Color 1 ..]
  </code></pre>
  
  <p>as suggested in the article, GHC says:</p>
  
  <pre><code>Can't make a derived instance of `Enum Color':
    `Color' must be an enumeration type
    (an enumeration consists of one or more nullary, non-GADT constructors)
    Try -XGeneralizedNewtypeDeriving for GHC's newtype-deriving extension
  In the newtype declaration for `Color'
  </code></pre>
  
  <p>I haven't worked with Enums much, how do I turn Color into an Enum type? Do I have to implement all the functions it defines? I thought they were all implemented when you derived that class.</p>