on master help sign in
Add MonadFix instance
commitacaf81096f741405e77748ae425c366f87737b79 authorAndrzej Rybczak <andrzej@rybczak.net> dateWed 30 Jun 2021, 19:24 (5 years ago) parenteb15092
1 file changed+4
src/Effectful/Internal/Monad.hs+4
src/Effectful/Internal/Monad.hs+4
@@ -41,6 +41,7 @@ import Control.Applicative (liftA2)
4141import Control.Concurrent (myThreadId)
4242import Control.Monad.Base
4343import Control.Monad.Catch
44+import Control.Monad.Fix
4445import Control.Monad.IO.Class
4546import Control.Monad.IO.Unlift
4647import Control.Monad.Trans.Control
@@ -137,6 +138,9 @@ instance Monad (Eff es) where
137138 -- https://gitlab.haskell.org/ghc/ghc/-/issues/20008
138139 Eff ma >> Eff mb = unsafeEff $ \es -> ma es >> mb es
139140
141+instance MonadFix (Eff es) where
142+ mfix f = unsafeEff $ \es -> mfix $ \a -> unEff (f a) es
143+
140144----------------------------------------
141145-- Exception
142146