[Haskell-cafe] Is there an escape from MonadState+MonadIO+MonadError monad stack?

Ömer Sinan Ağacan omeragacan at gmail.com
Sun Apr 7 00:02:12 CEST 2013

> You forgot to mention what your problem is. :)
> What you describe sounds reasonable. Why do you want to "escape"?

It's not really a problem,

I'm not happy with this design because to me it was like I'm missing
the point of using a 'functional' language. For instance, in most
parts of my code I can actually do IO. On the other hand, I know it's
mostly because of my application area and nothing to do with Haskell.
Let's say I just wanted to know ideas of experienced Haskell
programmers :-)


Ömer Sinan Ağacan

2013/4/7 Roman Cheplyaka <roma at ro-che.info>:
> Hi Ömer,
> You forgot to mention what your problem is. :)
> What you describe sounds reasonable. Why do you want to "escape"?
> Roman
> * Ömer Sinan Ağacan <omeragacan at gmail.com> [2013-04-07 00:22:58+0300]
>> Hi,
>> I'm a hobbyist Haskell programmer and my use of Haskell is mostly
>> consists of writing interpreters, simple virtual machines, and type
>> checkers.
>> One thing I'm not happy about my Haskell programs is, almost all of my
>> programs have a monad transformer stack consisting MonadError, MonadIO
>> and MonadState.
>> Let's say I'm writing an interpreter, I certainly need MonadIO to
>> interpret object language's IO functions: printing, reading from file
>> etc. I also need MonadState for, well, states(dynamic environment
>> etc.). MonadError is also required because most computations can
>> fail(unbound variable error, type mismatch etc. it can be also used
>> for implementing exceptions in object language)
>> Same applies for my other applications as well. Type checkers require
>> MonadError(unification error etc.), MonadState(to keep substitutions).
>> MonadIO is not required in this case. But it also required for virtual
>> machines(IOVector for memory -- ST vectors also work, but IO is still
>> required for other stuff - printing, display etc.)
>> I know these are mostly related with my application area, but I still
>> wanted to write this because I may be missing something, or simply
>> doing things wrong.
>> Advices from experienced Haskell programmers would be appreciated,
>> Cheers,
>> Ömer
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list