Missing MaybeT MonadFix instance

Levent Erkok erkokl at gmail.com
Fri Apr 8 19:14:21 CEST 2011


Hi Ross,

On Apr 8, 2011, at 6:50 AM, Ross Paterson wrote:
> instance (MonadFix m) => MonadFix (MaybeT m) where
>    mfix f = MaybeT (mfix (runMaybeT . f . unJust))
>      where unJust = fromMaybe (error "mfix MaybeT: Nothing")
> 
> is compatible with the MonadFix instance for Maybe, so it should
> probably go in.

For whatever it's worth, modulo names and type-wrappers, your definition above is the same as Equation 4.36 (pg. 54) of http://bit.ly/fGJMVD,  and Proposition 4.9.1 (on the same page) establishes that it's a good definition.

-Levent.


More information about the Libraries mailing list