Why the instance declaration , passing on Hug but failing on GHC 6.2.1?

wkc03 at mails.tsinghua.edu.cn wkc03 at mails.tsinghua.edu.cn
Thu May 19 04:20:13 EDT 2005


I am a novice from China. 
All the coeds are very simple as below:
   
   data People = A | B | C | D | E | F deriving (Show, Eq, Ord, Enum)
   data Pair a = Pair a a deriving Eq
   
   instance Show (Pair People) where
        show (Pair x y) = "<" ++ show x ++ ", " ++ show y ++ ">"

And the error in GHCi:

      Compiling Main             ( Main.hs, interpreted )
      
      Main.hs:5:
          Illegal instance declaration for `Show (Pair People)'
              (The instance type must be of form (T a b c)
               where T is not a synonym, and a,b,c are distinct type variables)
          In the instance declaration for `Show (Pair People)'
      Failed, modules loaded: none.

But it is puzzling that these code can pass on Hug! I thought that the syntaxn of
instance declaration is right! Then, Why did it fail?

Best regards,
  Wukaichen
       
                




More information about the Glasgow-haskell-users mailing list