File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
src/compiler/api/GF/Infra Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ import GF.Text.Pretty
3131import System.FilePath (makeRelative )
3232import Control.Parallel.Strategies (parList ,rseq ,using )
3333import Control.Monad (liftM ,ap )
34+ import Control.Monad.Fix (MonadFix (.. ))
3435import Control.Applicative (Applicative (.. ))
3536import qualified Control.Monad.Fail as Fail
3637
@@ -45,7 +46,6 @@ newtype Check a
4546instance Functor Check where fmap = liftM
4647
4748instance Monad Check where
48- return x = Check $ \ msgs -> Success x msgs
4949 f >>= g = Check $ \ ws ->
5050 case unCheck f ws of
5151 Success x msgs -> unCheck (g x) msgs
@@ -54,8 +54,14 @@ instance Monad Check where
5454instance Fail. MonadFail Check where
5555 fail = raise
5656
57+ instance MonadFix Check where
58+ mfix f = Check $ \ msgs ->
59+ let Check mf = f x
60+ r@ (Success x _) = mf msgs
61+ in r
62+
5763instance Applicative Check where
58- pure = return
64+ pure x = Check $ \ msgs -> Success x msgs
5965 (<*>) = ap
6066
6167instance ErrorMonad Check where
You can’t perform that action at this time.
0 commit comments