[Haskell-cafe] Hopefully simple monad question

Miguel Mitrofanov miguelimo38 at yandex.ru
Wed Sep 16 07:01:18 EDT 2009


O, great. I didn't know you can write it this way.

Tom Nielsen wrote:
> newtype VMT m a =
>   VMT {runVMT :: StateT VMState m a}
>     deriving (Monad, MonadIO, MonadTrans, TransM, MonadState VMState)
> 
> works  here (ghc-6.10.3)
> 
> On Wed, Sep 16, 2009 at 11:42 AM, Miguel Mitrofanov
> <miguelimo38 at yandex.ru> wrote:
> 
>> newtype VMT m a =
>>  VMT {runVMT :: StateT VMState m a}
>>    deriving (Monad, MonadIO, MonadTrans, TransM)
>>
>> Unfortunately, you can't automatically derive MonadState, since it's a
>> multi-paremeter type class. You'll have to write down the derivation
>> yourself.
> _______________________________________________
> 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