Hi, you cannot use sections with types and (->). Furthermore the variable must begin with a lowercase letter. So you have to write instance Functor (->) a where. By the way, you may write fmap = (.) instead of fmap f g = f . g. Yours, Wolfgang
Wolfgang Jeltsch wrote (on 29-10-01 23:43 +0100):
you cannot use sections with types and (->). Furthermore the variable must begin with a lowercase letter. So you have to write instance Functor (->) a where.
Actually, you have to write: instance Functor ((->) a) where since class Functor has arity *. This works because (->) a = (a ->) The outer parentheses are only there to ensure that the expression gets parsed as one argument, and not two. -- Frank Atanassow, Information & Computing Sciences, Utrecht University Padualaan 14, PO Box 80.089, 3508 TB Utrecht, Netherlands Tel +31 (030) 253-3261 Fax +31 (030) 251-379
Wolfgang Jeltsch wrote (on 29-10-01 23:43 +0100):
you cannot use sections with types and (->). Furthermore the variable must begin with a lowercase letter. So you have to write instance Functor (->) a where.
Erp, I said that the Functor class has arity *. Actually, it has arity 1 (i.e., it is a unary relation on types), with the argument being of kind *->*. This is one of the infelicities of the class system. -- Frank Atanassow, Information & Computing Sciences, Utrecht University Padualaan 14, PO Box 80.089, 3508 TB Utrecht, Netherlands Tel +31 (030) 253-3261 Fax +31 (030) 251-379
participants (3)
-
Chen Yu -
Frank Atanassow -
Wolfgang Jeltsch