Your error messages from ghc are correct: you have violated the
infamous C-T rule (section 4.3.2, page 32) which restricts instance
declarations to the module containing either the class or the
datatype.  Since (,) and Num are both in the prelude, you can't
compile this in official Haskell 1.2.  You could define your own
datatype isomorphic to (,) but you won't get the nice notation.

This should be legal in Haskell 1.3 (once it's done!) - the C-T rule
can be quite annoying so it's being relaxed.

Just remember: HUGS is not Haskell  :-).


  John Peterson
  Yale Haskell Project




Reply via email to