
9 Sep
2009
9 Sep
'09
5:50 p.m.
On Wed, Sep 09, 2009 at 09:51:34PM +0100, Amy de Buitléir wrote:
----- Quaternion.hs ----- data Quaternion = Quaternion Double Double Double Double deriving (Show)
(*) :: (Quaternion a) => a -> a -> a
Also, I should point out that the '(blah) => ...' syntax is only for type *classes*; Quaternion is just a data type so it doesn't make sense to use it in this way. The type signature instead ought to just say (*) :: Quaternion -> Quaternion -> Quaternion although as others have pointed out you will still get the error about (*) being ambiguous. You can either implement Num as others have suggested, or just use a different name for quaternion multiplication, such as, say, (*!). -Brent