apfelmus wrote: > Maxime Henrion wrote: > > class MonadState m where > > type StateType m :: * > > get :: m StateType > > put :: m StateType -> m () > > > > As for instances: > > > > instance MonadState (State s) where > > type StateType = s -- this is line 22 > > When defining the type function StateType, you have to give it the > required argument m = State s: > > type StateType (State s) = s > > > get = State $ \s -> (s, s) > > put s = State $ \_ -> ((), s)
I tried that too already, it gives: State.hs:19:39: Kind mis-match Expected kind `k -> *', but `()' has kind `*' In the type `m ()' In the type `m StateType -> m ()' In the class declaration for `MonadState' Line 19 being the definition of put in the class. Cheers, Maxime _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe