[Haskell-beginners] Problems defining a type with a multiplication function

John Dorsey haskell at colquitt.org
Wed Sep 9 17:10:38 EDT 2009


Amy,

> instance Num Quaternion where

Use this (from Joe's email), and not

> instance Num (Quaternion a)

this (from mine).  I had skimmed your code too quickly and wrote the above
in error because I'd thought you had make Quaternion parametric.  Unless you
want the parametricity, as in:

data Quaternion a = Quaternion a a a a

class (Num a) => Num (Quaternion a) where
  ...

Cheers,
John



More information about the Beginners mailing list