Title: Type classes question

Hello,

I am trying to define class Dual and few instances as follows:

===
class Dual a where
    dual :: a -> a

instance Dual Bool where
    dual = not

instance (Dual a, Dual b) => Dual (a -> b) where
    dual f = dual . f . dual

instance Dual a => Dual [a] where
    dual = reverse . map dual

instance Num a => Dual a where
    dual = negate
===

For some reason Hugs does not lake the last definition saying 'ERROR dual.hs:13 - syntax error in instance head (constructor expected)'. What am I doing wrong?

-- Eugene

Reply via email to