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

Reply via email to