From 3ee4f6ce9c22140f09e68ddfacaef2dfa7b4007b Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Thu, 13 Nov 2025 10:58:16 +0100 Subject: [PATCH] added MonadFix and fix how return is defined --- src/compiler/api/GF/Infra/CheckM.hs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/compiler/api/GF/Infra/CheckM.hs b/src/compiler/api/GF/Infra/CheckM.hs index 5a0ac0fcc..027727e78 100644 --- a/src/compiler/api/GF/Infra/CheckM.hs +++ b/src/compiler/api/GF/Infra/CheckM.hs @@ -31,6 +31,7 @@ import GF.Text.Pretty import System.FilePath(makeRelative) import Control.Parallel.Strategies(parList,rseq,using) import Control.Monad(liftM,ap) +import Control.Monad.Fix(MonadFix(..)) import Control.Applicative(Applicative(..)) import qualified Control.Monad.Fail as Fail @@ -45,7 +46,6 @@ newtype Check a instance Functor Check where fmap = liftM instance Monad Check where - return x = Check $ \msgs -> Success x msgs f >>= g = Check $ \ws -> case unCheck f ws of Success x msgs -> unCheck (g x) msgs @@ -54,8 +54,14 @@ instance Monad Check where instance Fail.MonadFail Check where fail = raise +instance MonadFix Check where + mfix f = Check $ \msgs -> + let Check mf = f x + r@(Success x _) = mf msgs + in r + instance Applicative Check where - pure = return + pure x = Check $ \msgs -> Success x msgs (<*>) = ap instance ErrorMonad Check where