Writing for both State and StateT
Tue, 22 Apr 2003 14:12:06 -0500
> On Tue, 22 Apr 2003, Derek Elkins wrote:
> > I had a similar problem, but that was because I needed to use the
> > constructors. MonadState has the methods you are using just write
> > your code requiring MonadState as both State and StateT are
> > instances.
> > next_random_probability :: ( ..., MonadState g m) => m a
> Works perfectly, thanks very much! That must be the only combination I
> didn't try. (-:
When you have two identical methods like this, you can try removing the
type from one and seeing what hugs or ghci thinks the type is. Then,
you can specialize that if you want.
> No doubt it'll all be clearer when I better understand what's going on!