From 30f189a48c4e2ebf36e4970d63c53a9d21bff3c6 Mon Sep 17 00:00:00 2001 From: Maximilian Tagher Date: Sun, 20 Sep 2020 16:50:16 -0400 Subject: [PATCH 1/3] Remove GHandler from handlerToIO docs --- yesod-core/ChangeLog.md | 4 ++++ yesod-core/src/Yesod/Core/Handler.hs | 24 ++++++++++++------------ yesod-core/yesod-core.cabal | 2 +- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/yesod-core/ChangeLog.md b/yesod-core/ChangeLog.md index 881c0e87..ef898d9e 100644 --- a/yesod-core/ChangeLog.md +++ b/yesod-core/ChangeLog.md @@ -1,5 +1,9 @@ # ChangeLog for yesod-core +## 1.6.18.3 + +* Remove mention of an oudated Yesod type (`GHandler`) from the docs for `handlerToIO`. []() + ## 1.6.18.2 * Recommends `.yesodroutes` as the file extension for Yesod routes files. [#1686](https://github.com/yesodweb/yesod/pull/1686) diff --git a/yesod-core/src/Yesod/Core/Handler.hs b/yesod-core/src/Yesod/Core/Handler.hs index 8237917a..d654a75f 100644 --- a/yesod-core/src/Yesod/Core/Handler.hs +++ b/yesod-core/src/Yesod/Core/Handler.hs @@ -369,10 +369,10 @@ getPostParams = do getCurrentRoute :: MonadHandler m => m (Maybe (Route (HandlerSite m))) getCurrentRoute = rheRoute <$> askHandlerEnv --- | Returns a function that runs 'HandlerT' actions inside @IO@. +-- | Returns a function that runs 'HandlerFor' actions inside @IO@. -- --- Sometimes you want to run an inner 'HandlerT' action outside --- the control flow of an HTTP request (on the outer 'HandlerT' +-- Sometimes you want to run an inner 'HandlerFor' action outside +-- the control flow of an HTTP request (on the outer 'HandlerFor' -- action). For example, you may want to spawn a new thread: -- -- @ @@ -380,30 +380,30 @@ getCurrentRoute = rheRoute <$> askHandlerEnv -- getFooR = do -- runInnerHandler <- handlerToIO -- liftIO $ forkIO $ runInnerHandler $ do --- /Code here runs inside GHandler but on a new thread./ --- /This is the inner GHandler./ +-- /Code here runs inside HandlerFor but on a new thread./ +-- /This is the inner HandlerFor./ -- ... -- /Code here runs inside the request's control flow./ --- /This is the outer GHandler./ +-- /This is the outer HandlerFor./ -- ... -- @ -- -- Another use case for this function is creating a stream of --- server-sent events using 'GHandler' actions (see +-- server-sent events using 'HandlerFor' actions (see -- @yesod-eventsource@). -- --- Most of the environment from the outer 'GHandler' is preserved --- on the inner 'GHandler', however: +-- Most of the environment from the outer 'HandlerFor' is preserved +-- on the inner 'HandlerFor', however: -- -- * The request body is cleared (otherwise it would be very -- difficult to prevent huge memory leaks). -- -- * The cache is cleared (see 'CacheKey'). -- --- Changes to the response made inside the inner 'GHandler' are +-- Changes to the response made inside the inner 'HandlerFor' are -- ignored (e.g., session variables, cookies, response headers). --- This allows the inner 'GHandler' to outlive the outer --- 'GHandler' (e.g., on the @forkIO@ example above, a response +-- This allows the inner 'HandlerFor' to outlive the outer +-- 'HandlerFor' (e.g., on the @forkIO@ example above, a response -- may be sent to the client without killing the new thread). handlerToIO :: MonadIO m => HandlerFor site (HandlerFor site a -> m a) handlerToIO = diff --git a/yesod-core/yesod-core.cabal b/yesod-core/yesod-core.cabal index 86f030f0..ce9c902c 100644 --- a/yesod-core/yesod-core.cabal +++ b/yesod-core/yesod-core.cabal @@ -1,5 +1,5 @@ name: yesod-core -version: 1.6.18.2 +version: 1.6.18.3 license: MIT license-file: LICENSE author: Michael Snoyman From f0db028ec0f11d419272bee0f6cd9d21575a3408 Mon Sep 17 00:00:00 2001 From: Maximilian Tagher Date: Sun, 20 Sep 2020 16:54:44 -0400 Subject: [PATCH 2/3] .. --- yesod-core/src/Yesod/Core/Handler.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yesod-core/src/Yesod/Core/Handler.hs b/yesod-core/src/Yesod/Core/Handler.hs index d654a75f..57c814ba 100644 --- a/yesod-core/src/Yesod/Core/Handler.hs +++ b/yesod-core/src/Yesod/Core/Handler.hs @@ -398,7 +398,7 @@ getCurrentRoute = rheRoute <$> askHandlerEnv -- * The request body is cleared (otherwise it would be very -- difficult to prevent huge memory leaks). -- --- * The cache is cleared (see 'CacheKey'). +-- * The cache is cleared (see 'cached'). -- -- Changes to the response made inside the inner 'HandlerFor' are -- ignored (e.g., session variables, cookies, response headers). @@ -428,7 +428,7 @@ handlerToIO = -- xx From this point onwards, no references to oldHandlerData xx liftIO $ evaluate (newReq `seq` oldEnv `seq` newState `seq` ()) - -- Return GHandler running function. + -- Return HandlerFor running function. return $ \(HandlerFor f) -> liftIO $ runResourceT $ withInternalState $ \resState -> do From 6e5fa23dc227a937324568e61d6d0fd6694c6aae Mon Sep 17 00:00:00 2001 From: Maximilian Tagher Date: Sun, 20 Sep 2020 16:57:01 -0400 Subject: [PATCH 3/3] .. --- yesod-core/ChangeLog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yesod-core/ChangeLog.md b/yesod-core/ChangeLog.md index ef898d9e..14efa3e5 100644 --- a/yesod-core/ChangeLog.md +++ b/yesod-core/ChangeLog.md @@ -2,7 +2,7 @@ ## 1.6.18.3 -* Remove mention of an oudated Yesod type (`GHandler`) from the docs for `handlerToIO`. []() +* Remove mention of an oudated Yesod type (`GHandler`) from the docs for `handlerToIO`. [https://github.com/yesodweb/yesod/pull/1695](#1695) ## 1.6.18.2