[Haskell-cafe] Re: Why is type 'b' forced to be type 'm a' and not possibly 'm a -> m a'

tpledger at ihug.co.nz tpledger at ihug.co.nz
Wed Sep 20 03:38:04 EDT 2006

Vivian McPhail wrote:
> > > class Forkable a where
> > >     fork :: String -> a -> a -> a
> What I would like to be able to do is
> differentiate between Forkable (m a ->
> b) and Forkable (<function type> -> b).

Have you tried this combination of instances?

    instance Forkable (IO a) where ...
    -- and similarly for all the concrete
    -- monad types you will use fork with

    instance (Forkable a, Forkable b) =>
             Forkable (a -> b) where ...

Alternatively, since the fork function seems to be all about
propagating a value (the String), would Control.Monad.Reader
serve your purpose?


More information about the Haskell-Cafe mailing list