[Haskell-cafe] combining monads with IO

Miguel Mitrofanov miguelimo38 at yandex.ru
Thu Jun 25 09:44:35 EDT 2009


Sure:

newtype IOMayfail a = IOMayfail {runIOMayfail :: MaybeT IO a}

instance Monad IOMayfail where
   return = IOMayfail . return
   IOMayfail m >>= f = IOMayfail $ m >>= runIOMayfail . f
   fail = whatever you like

Matthias Görgens wrote on 25.06.2009 17:28:
> Thanks.  Can I add something like fail?


More information about the Haskell-Cafe mailing list