[Haskell] "Classic" vs. "Cunning Newtype" Derivation

Ashley Yakeley ashley at semantic.org
Mon Mar 7 19:06:44 EST 2005


I make quite a lot of use of "cunning newtype" deriviation (in GHC), 
because it's easy to understand.

  newtype Mytype = MkMytype T deriving C

However, if I use one of the standard derivable classes (Eq, Ord, Enum, 
Bounded, Show, and Read), I believe that form of deriving takes priority.

AFAICT from the H98 Report ch. 10, for Eq, Ord and Bounded this works 
out as the same thing, Enum doesn't apply, and Read and Show do 
something different. Is this correct, or are there subtle differences?

-- 
Ashley Yakeley, Seattle WA



More information about the Haskell mailing list