
1 Apr
2011
1 Apr
'11
8:51 p.m.
Is there a particular reason that the transformershttp://hackage.haskell.org/packages/archive/transformers/latest/doc/html/Con...version of the MaybeT monad does not have a MonadFix instance? It seems like the following instance would be suitable: instance (MonadFix m) => MonadFix (MaybeT m) where mfix f = MaybeT $ mfix $ \a -> runMaybeT $ f $ case a of Just a -> a Nothing -> error "mfix MaybeT: Nothing" I don't think it's possible to hit the error case: In order to terminate f cannot be strict so it must return a value without evaluating its input. If f returns a Nothing, then you have your return value and you're done. If f returns a Just, then we don't hit the error case. - Job