On Fri, 31 Oct 2008, Jonathan Cast wrote:
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
Yikes. Just search the archives for `Set not a Monad'; you have the
same issue.
I think that this would be the answer if he is after a constraint for 'a',
but he wants to constraint 'g'.
Hint: data RandomGen g => RandomMonad g a means nothing at all like what
you think it means.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe