[Haskell-cafe] Newbie on instance of Monad

2008-10-31 Thread Mauricio
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)

Re: [Haskell-cafe] Newbie on instance of Monad

2008-10-31 Thread Henning Thielemann
On Fri, 31 Oct 2008, 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) RandomGen g is considered the constraint for the application of RandomMonad constructor, but GHC does not

Re: [Haskell-cafe] Newbie on instance of Monad

2008-10-31 Thread Henning Thielemann
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 =

Re: [Haskell-cafe] Newbie on instance of Monad

2008-10-31 Thread Jonathan Cast
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 =