On Fri, 2008-10-31 at 18:43 -0200, Mauricio wrote: > Hi, > > After a lot of thinking, I can't get what I > am doing wrong in this code: > > ------ > data ( RandomGen g ) => RandomMonad g a = RandomMonad (g -> a) > > instance Monad (RandomMonad g) where > return = RandomMonad . const > RandomMonad f1 >>= f2 = RandomMonad f3 where > f3 a = f2f1 a (next a) > RandomMonad f2f1 = f2 . f1 > ------ > > I get this error message: > > Could not deduce (RandomGen g) > from the context (Monad (RandomMonad g)) > arising from a use of `RandomMonad' at src/encherDB.hs:10:11-21 > Possible fix: > add (RandomGen g) to the context of the type signature for `return' > In the first argument of `(.)', namely `RandomMonad' > In the expression: RandomMonad . const > In the definition of `return': return = RandomMonad . const > > but I'm not smart enough to understand what > it means.
Yikes. Just search the archives for `Set not a Monad'; you have the same issue. Hint: data RandomGen g => RandomMonad g a means nothing at all like what you think it means. jcc _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
