From 07cd877a02f94c2f504e8f16ea3cd2e23120a1e6 Mon Sep 17 00:00:00 2001 From: Ryan Hendrickson Date: Wed, 12 Mar 2025 04:21:50 -0400 Subject: [PATCH] Remove noncanonical definitions This appeases the -Wnoncanonical-monad-instances warning. This warning exists because a future GHC release may treat noncanonical definitions as errors. See also: https://gitlab.haskell.org/ghc/ghc/-/wikis/proposal/monad-of-no-return --- src/Control/Monad/Ghc.hs | 2 +- src/Hint/InterpreterT.hs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Control/Monad/Ghc.hs b/src/Control/Monad/Ghc.hs index 93d8deb..d85e87b 100644 --- a/src/Control/Monad/Ghc.hs +++ b/src/Control/Monad/Ghc.hs @@ -35,7 +35,7 @@ newtype GhcT m a = GhcT { unGhcT :: GHC.GhcT (MTLAdapter m) a } deriving (Functor, Monad, GHC.HasDynFlags) instance (Functor m, Monad m) => Applicative (GhcT m) where - pure = return + pure = GhcT . pure (<*>) = ap -- adapted from https://github.com/ghc/ghc/blob/ghc-8.2/compiler/main/GHC.hs#L450-L459 diff --git a/src/Hint/InterpreterT.hs b/src/Hint/InterpreterT.hs index 1c3fff3..5d279ca 100644 --- a/src/Hint/InterpreterT.hs +++ b/src/Hint/InterpreterT.hs @@ -196,5 +196,5 @@ instance (MonadIO m, MonadMask m, Functor m) => MonadInterpreter (InterpreterT m runGhc = runGhcImpl instance (Monad m) => Applicative (InterpreterT m) where - pure = return + pure = InterpreterT . pure (<*>) = ap