[Haskell-cafe] Is there an escape from MonadState+MonadIO+MonadError monad stack?
kudah
kudahkukarek at gmail.com
Sun Apr 7 01:18:58 CEST 2013
On Sun, 7 Apr 2013 01:02:12 +0300 Ömer Sinan Ağacan
<omeragacan at gmail.com> wrote:
> I'm not happy with this design because to me it was like I'm missing
> the point of using a 'functional' language.
You kind of do, e.g. you might not be able to test parts of your
program independently.
> For instance, in most parts of my code I can actually do IO.
You can disable IO in parts of your code by making it polymorphic over
monad.
{-# LANGUAGE RankNTypes #-}
type MonadStack = ErrorT Err (StateT St IO)
type MonadStackNoIO = forall m. Monad m => ErrorT Err (StateT St m)
More information about the Haskell-Cafe
mailing list