[Haskell-cafe] GHCi infers a type but refuses it as type signature

Luke Palmer lrpalmer at gmail.com
Tue Jun 23 20:19:31 EDT 2009

On Tue, Jun 23, 2009 at 6:05 PM, Eric Dedieu <papa.eric at free.fr> wrote:

> So
> 1) How can I use transformers instead of the mtl? This is in no
> tutorial, and searchinf for "mtl" on the haskell wiki yields no
> result at all.

> cabal install transformers   (you need cabal-install to do this... consult
#haskell if confused)
perhaps:  > ghc-pkg hide mtl   (I think mtl and transformers fight over the
Control.Monad module)

Then import Control.Monad.Trans.State instead of Control.Monad.State.  All
else should be well, if I am not forgetting something.

> 2) What should be the Haskell98-compatible type signature for my play2
> function, instead of (MonadState [a] m, Eq a) =>
> a -> m Bool ?

That depends on the monad library.  In transformers it would be:

(Monad m, Eq a) => a -> StateT [a] m Bool

State s is just a type synonym for StateT s Identity, so this works for
State as well.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090623/1863ab73/attachment.html

More information about the Haskell-Cafe mailing list