[Haskell-cafe] Help mixing pure and IO code

2009-11-29 Thread papa . eric
Hi haskell helpers, Learning haskell, I wanted to explore how to write pure code and then add some IO on top of it, keeping the main code pure. The idea was to write a very simple two-player game, then define some strategies to play it that do not involve IO, and finally use strategies involving

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

2009-06-24 Thread papa . eric
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

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

2009-06-23 Thread papa . eric
Simple: the definition of MonadState uses those extensions. Thanks, yes it helps and explains all. :^) I suppose then that if -XFlexibleContexts is indeed required by the standard libraries, it is a safe extension, meaning supported by all compilers? Are many such extensions de-facto standard