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

papa.eric at free.fr papa.eric at free.fr
Wed Jun 24 07:43:51 EDT 2009


> 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.

I like it, it is simpler than the one using MonadState.

I had read many tutorials and wiki articles, and saw nowhere that there were different implementations of what seemed to be standard libraries.


> On a higher level, in case you are interested, here's a description of
> how I would model your problem.

Actually using a monad transformer was the goal of it all, tutorial-like. The example was contrived.

Another question would be: when is it relevant to use monad transformers? I'm not sure to have enough haskell practice to be ready for that one, though. :^)  And for sure, my example didn't need it.

Thanks
Eric


More information about the Haskell-Cafe mailing list