Curious. I think this quite likely is a bug in 3.02, but not, I think in the current version. It doesn't happen with my copy of the compiler, which is up to date wrt the repository. I did fix something similar a few weeks back... try cvs update and retry? Simon > -----Original Message----- > From: P.C.Callaghan [mailto:[EMAIL PROTECTED]] > Sent: Saturday, March 13, 1999 4:55 PM > To: [EMAIL PROTECTED] > Subject: Another bug with constructor class ((->) a) > > > > ghc 3.02, 4.03 (from cvs) both refuse to accept the > following, despite > the presence of the SPECIALISE pragma. > > Hugs98 accepts it. > > Thanks > Paul Callaghan > > > ps. the error message given is > > test-fmap.lhs:18: > No instance for `Functor ((->) [Char])' > arising from use of `foo' at test-fmap.lhs:18 > > > ----------------------- > > #if __GLASGOW_HASKELL__ < 400 > #define fmap map > #else > #endif > > > data TT = TT Int Char deriving Show > > > instance Monad ((->) a) where > > return a = \s -> a > > m >>= f = \s -> f (m s) s > > > {-#SPECIALISE instance Functor ((->) String) #-} > > > foo :: (Functor a, Functor b) => b (a Char) -> b (a TT) > > foo = fmap (fmap $ TT 2) > > > main = foo (\x -> return 'a') "x" >>= print >
