id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,os,architecture,failure,difficulty,testcase,blockedby,blocking,related
2734,Newtype deriving over phantom types broke between GHC 6.6.1 and GHC 6.8.1,DavidA,,"Consider the following code:
{{{
{-# OPTIONS_GHC -fglasgow-exts -fallow-undecidable-instances #-}

data Lex

data Glex

newtype Monomial ord = M [Int] deriving (Eq,Show)

instance Ord (Monomial Lex) where
    compare (M xs) (M ys) = compare xs ys

instance Ord (Monomial Glex) where
    compare (M xs) (M ys) = compare (sum xs, xs) (sum ys, ys)

-- newtype Polynomial ord = P [Monomial ord] deriving (Eq,Show,Ord)

newtype Polynomial ord = P [Monomial ord] deriving (Eq,Show)

instance Ord (Monomial ord) => Ord (Polynomial ord) where
    compare (P ts) (P us) = compare ts us
}}}
In 6.6.1, it was permissible to derive the Ord instance for Polynomial ord from the ord instance for Monomial ord - the commented out code would compile. In 6.8.1-3, the commented out code doesn't compile, so you have to do the derivation by hand, as shown.",bug,closed,normal,,Compiler,6.8.3,invalid,"newtype deriving, phantom type",,Windows,x86,,Unknown,,,,
