From b914a25de326dd937e3a1d05f4eefb46af6da7b4 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 9 Sep 2024 19:43:39 +0200 Subject: define return in terms of pure, >> as *>, mappend as <> In preparation for deprecation, see https://gitlab.haskell.org/ghc/ghc/-/wikis/proposal/semigroup-monoid and https://gitlab.haskell.org/ghc/ghc/-/wikis/proposal/monad-of-no-return --- src/compiler/GF/Infra/CheckM.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/compiler/GF/Infra/CheckM.hs') diff --git a/src/compiler/GF/Infra/CheckM.hs b/src/compiler/GF/Infra/CheckM.hs index a5ff7148a..1dd26dd5c 100644 --- a/src/compiler/GF/Infra/CheckM.hs +++ b/src/compiler/GF/Infra/CheckM.hs @@ -48,7 +48,7 @@ newtype Check a instance Functor Check where fmap = liftM instance Monad Check where - return x = Check $ \{-ctxt-} ws -> (ws,Success x) + return = pure f >>= g = Check $ \{-ctxt-} ws -> case unCheck f {-ctxt-} ws of (ws,Success x) -> unCheck (g x) {-ctxt-} ws @@ -58,7 +58,7 @@ instance Fail.MonadFail Check where fail = raise instance Applicative Check where - pure = return + pure x = Check $ \{-ctxt-} ws -> (ws,Success x) (<*>) = ap instance ErrorMonad Check where -- cgit v1.2.3