[Haskell-cafe] Fighting the monad stack, MonadIO
Antoine Latter
aslatter at gmail.com
Thu Apr 10 13:47:57 EDT 2008
On Thu, Apr 10, 2008 at 12:44 PM, Antoine Latter <aslatter at gmail.com> wrote:
> {-# LANGUAGE GeneralizedNewtypeDeriving #-}
>
> import Control.Monad.Trans
> import Control.Monad.State
> import Control.Monad.Error
>
> type BrowserAction = IO -- or something else which is in MondaIO
> data RBState = RBState
>
>
> newtype RBAction a = RBAction
> { exec :: ErrorT String (StateT RBState BrowserAction) a }
> deriving (Functor, Monad, MonadState RBState, MonadIO)
D'oh! Deriving MonadIO for the newtype should work, so long as
BrowserAction is in the MonadIO class.
-Antoine
More information about the Haskell-Cafe
mailing list