Writing for both State and StateT

Mark Carroll mark@chaos.x-philes.com
Tue, 22 Apr 2003 15:59:13 -0400 (EDT)


On Tue, 22 Apr 2003, Jon Cast wrote:

> 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.

Unfortunately, in this case, with that function in isolation I get,

    Ambiguous type variable(s) `s', `m'
        in the constraint `MonadState s m'
    arising from use of `get' ....

and with it being used in other functions I get things like,

    Inferred type is less polymorphic than expected
	Quantified type variable `m' escapes

or similar. That is, I haven't yet managed to make the function compile
without a type signature!

I have found your technique useful in other contexts, though. (-:

-- Mark