[Haskell-cafe] Delaling with State StateT and IO in the same function

Kirsten Chevalier catamorphism at gmail.com
Mon Feb 26 18:19:28 EST 2007


On 2/26/07, Alfonso Acosta <alfonso.acosta at gmail.com> wrote:
>
> The returned type is a StateT and the only way in which I succesfully
> managed to internally work with both State and StateT is converting
> from the former to the later one using this function (not elegant at
> all)

I may be missing something, but why are you using both State and
StateT? Maybe I don't understand your code, but it seems like you
could be using StateT everywhere you're currently using State.

Also, your type signatures would be easier to read if you defined a
type synonym for your instantiation of StateT, e.g.:

type AlfonsoM s = StateT s IO ()

and then everywhere you write (StateT s IO ()) now, you could write
(AlfonsoM s) instead.

Cheers,
Kirsten

-- 
Kirsten Chevalier* chevalier at alum.wellesley.edu *Often in error, never in doubt
"...People who mind their own business die of boredom at thirty."--Robertson
Davies


More information about the Haskell-Cafe mailing list