From bbc4803ec184e80fd2007595ca2a1741c1642c72 Mon Sep 17 00:00:00 2001 From: ludat-coding-agent Date: Sun, 19 Jul 2026 16:06:58 +0000 Subject: [PATCH] Remove noncanonical definitions. This appeases the `-Wnoncanonical-monad-instances` warning. A future GHC release will treat noncanonical definitions as errors. See https://github.com/haskell/core-libraries-committee/issues/328. --- lib/Scanner/Internal.hs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/Scanner/Internal.hs b/lib/Scanner/Internal.hs index b2fb829..dad5885 100644 --- a/lib/Scanner/Internal.hs +++ b/lib/Scanner/Internal.hs @@ -46,7 +46,8 @@ instance Functor Scanner where instance Applicative Scanner where {-# INLINE pure #-} - pure = return + pure a = Scanner $ \bs next -> + next bs a {-# INLINE (<*>) #-} (<*>) = ap @@ -57,10 +58,6 @@ instance Applicative Scanner where s1 <* s2 = s1 >>= \a -> s2 >> return a instance Monad Scanner where - {-# INLINE return #-} - return a = Scanner $ \bs next -> - next bs a - {-# INLINE (>>=) #-} s1 >>= s2 = Scanner $ \bs next -> run s1 bs $ \bs' a ->