From 7b38a7644e5659cb31aa469b7d070610f1365488 Mon Sep 17 00:00:00 2001 From: Janus Troelsen Date: Fri, 23 Oct 2026 23:05:43 -0600 Subject: [PATCH] Do not depend on Monad(return) This still retains use of the `return` binding, but according to the reduced breakage plan, the binding will stay, as a function outside of the class. So we just need to import it as part of explicit import lists. See https://gitlab.haskell.org/ghc/ghc/-/wikis/Proposal/Monad-Of-No-Return#reduced-breakage-variant --- happstack-server.cabal | 4 ++-- src/Happstack/Server/Internal/Monads.hs | 8 +++----- src/Happstack/Server/RqData.hs | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/happstack-server.cabal b/happstack-server.cabal index 7ec4189..4f3784a 100644 --- a/happstack-server.cabal +++ b/happstack-server.cabal @@ -81,7 +81,7 @@ Library network-uri >= 2.6 && < 2.7 else build-depends: network < 2.6 - Build-Depends: base >= 4 && < 5, + Build-Depends: base >= 4.8 && < 5, base64-bytestring >= 1.0 && < 1.3, blaze-html >= 0.5 && < 0.10, bytestring, @@ -138,7 +138,7 @@ Test-Suite happstack-server-tests GHC-Options: -threaded hs-source-dirs: tests Build-depends: HUnit, - base >= 4 && < 5, + base >= 4.8 && < 5, bytestring, containers, happstack-server, diff --git a/src/Happstack/Server/Internal/Monads.hs b/src/Happstack/Server/Internal/Monads.hs index 3505a55..19474d2 100644 --- a/src/Happstack/Server/Internal/Monads.hs +++ b/src/Happstack/Server/Internal/Monads.hs @@ -61,7 +61,7 @@ import Happstack.Server.Internal.RFC822Headers (parseContentType) import Happstack.Server.Internal.Types (EscapeHTTP(..), canHaveBody) import Happstack.Server.Internal.TimeoutIO (TimeoutIO) import Happstack.Server.Types -import Prelude (Bool(..), Either(..), Eq(..), Functor(..), IO, Monad(..), Char, Maybe(..), String, Show(..), ($), (.), (>), (++), (&&), (||), (=<<), const, concatMap, flip, id, otherwise, zip) +import Prelude (Bool(..), Either(..), Eq(..), Functor(..), IO, Monad(..), return, (>>), Char, Maybe(..), String, Show(..), ($), (.), (>), (++), (&&), (||), (=<<), const, concatMap, flip, id, otherwise, zip) -- | An alias for 'WebT' when using 'IO'. type Web a = WebT IO a @@ -194,7 +194,7 @@ instance (Monad m, MonadPlus m) => Monoid (ServerPartT m a) where mappend = (SG.<>) instance (Monad m, Functor m) => Applicative (ServerPartT m) where - pure = return + pure a = ServerPartT $ pure a (<*>) = ap instance (Functor m, MonadPlus m) => Alternative (ServerPartT m) where @@ -477,8 +477,6 @@ type UnWebT m a = m (Maybe (Either Response a, FilterFun Response)) instance Monad m => Monad (WebT m) where m >>= f = WebT $ unWebT m >>= unWebT . f {-# INLINE (>>=) #-} - return a = WebT $ return a - {-# INLINE return #-} #if MIN_VERSION_base(4,9,0) instance MonadFail m => MonadFail (WebT m) where @@ -567,7 +565,7 @@ localContext fn hs = withRequest $ \rq -> fn (runServerPartT hs rq) instance (Monad m, Functor m) => Applicative (WebT m) where - pure = return + pure a = WebT $ pure a (<*>) = ap instance (Functor m, MonadPlus m) => Alternative (WebT m) where diff --git a/src/Happstack/Server/RqData.hs b/src/Happstack/Server/RqData.hs index 17ad891..50f71a3 100644 --- a/src/Happstack/Server/RqData.hs +++ b/src/Happstack/Server/RqData.hs @@ -114,7 +114,7 @@ instance (Monoid e) => Applicative (ReaderError r e) where #else instance (Monoid e, DeprecatedError.Error e) => Applicative (ReaderError r e) where #endif - pure = return + pure a = ReaderError $ pure a (ReaderError (ReaderT f)) <*> (ReaderError (ReaderT a)) = ReaderError $ ReaderT $ \env -> (f env) `apEither` (a env)