Merge pull request #1695 from yesodweb/removeGHandlerFromDocs

Remove GHandler from handlerToIO docs
This commit is contained in:
Michael Snoyman 2020-09-21 05:29:19 +03:00 committed by GitHub
commit 84ca72e1d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 15 deletions

View File

@ -1,5 +1,9 @@
# ChangeLog for yesod-core # ChangeLog for yesod-core
## 1.6.18.3
* 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 ## 1.6.18.2
* Recommends `.yesodroutes` as the file extension for Yesod routes files. [#1686](https://github.com/yesodweb/yesod/pull/1686) * Recommends `.yesodroutes` as the file extension for Yesod routes files. [#1686](https://github.com/yesodweb/yesod/pull/1686)

View File

@ -369,10 +369,10 @@ getPostParams = do
getCurrentRoute :: MonadHandler m => m (Maybe (Route (HandlerSite m))) getCurrentRoute :: MonadHandler m => m (Maybe (Route (HandlerSite m)))
getCurrentRoute = rheRoute <$> askHandlerEnv 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 -- Sometimes you want to run an inner 'HandlerFor' action outside
-- the control flow of an HTTP request (on the outer 'HandlerT' -- the control flow of an HTTP request (on the outer 'HandlerFor'
-- action). For example, you may want to spawn a new thread: -- action). For example, you may want to spawn a new thread:
-- --
-- @ -- @
@ -380,30 +380,30 @@ getCurrentRoute = rheRoute <$> askHandlerEnv
-- getFooR = do -- getFooR = do
-- runInnerHandler <- handlerToIO -- runInnerHandler <- handlerToIO
-- liftIO $ forkIO $ runInnerHandler $ do -- liftIO $ forkIO $ runInnerHandler $ do
-- /Code here runs inside GHandler but on a new thread./ -- /Code here runs inside HandlerFor but on a new thread./
-- /This is the inner GHandler./ -- /This is the inner HandlerFor./
-- ... -- ...
-- /Code here runs inside the request's control flow./ -- /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 -- 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@). -- @yesod-eventsource@).
-- --
-- Most of the environment from the outer 'GHandler' is preserved -- Most of the environment from the outer 'HandlerFor' is preserved
-- on the inner 'GHandler', however: -- on the inner 'HandlerFor', however:
-- --
-- * The request body is cleared (otherwise it would be very -- * The request body is cleared (otherwise it would be very
-- difficult to prevent huge memory leaks). -- 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 'GHandler' are -- Changes to the response made inside the inner 'HandlerFor' are
-- ignored (e.g., session variables, cookies, response headers). -- ignored (e.g., session variables, cookies, response headers).
-- This allows the inner 'GHandler' to outlive the outer -- This allows the inner 'HandlerFor' to outlive the outer
-- 'GHandler' (e.g., on the @forkIO@ example above, a response -- 'HandlerFor' (e.g., on the @forkIO@ example above, a response
-- may be sent to the client without killing the new thread). -- may be sent to the client without killing the new thread).
handlerToIO :: MonadIO m => HandlerFor site (HandlerFor site a -> m a) handlerToIO :: MonadIO m => HandlerFor site (HandlerFor site a -> m a)
handlerToIO = handlerToIO =
@ -428,7 +428,7 @@ handlerToIO =
-- xx From this point onwards, no references to oldHandlerData xx -- xx From this point onwards, no references to oldHandlerData xx
liftIO $ evaluate (newReq `seq` oldEnv `seq` newState `seq` ()) liftIO $ evaluate (newReq `seq` oldEnv `seq` newState `seq` ())
-- Return GHandler running function. -- Return HandlerFor running function.
return $ \(HandlerFor f) -> return $ \(HandlerFor f) ->
liftIO $ liftIO $
runResourceT $ withInternalState $ \resState -> do runResourceT $ withInternalState $ \resState -> do

View File

@ -1,5 +1,5 @@
name: yesod-core name: yesod-core
version: 1.6.18.2 version: 1.6.18.3
license: MIT license: MIT
license-file: LICENSE license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com> author: Michael Snoyman <michael@snoyman.com>