Merge pull request #1703 from jeffhappily/update-docs-for-handlert
Replace HandlerT with HandlerFor in the documentation
This commit is contained in:
commit
0325a24826
@ -1,5 +1,9 @@
|
|||||||
# ChangeLog for yesod-core
|
# ChangeLog for yesod-core
|
||||||
|
|
||||||
|
## 1.6.18.6
|
||||||
|
|
||||||
|
* Update documentation from `HandlerT` to `HandlerFor` [#1703](https://github.com/yesodweb/yesod/pull/1703)
|
||||||
|
|
||||||
## 1.6.18.5
|
## 1.6.18.5
|
||||||
|
|
||||||
Document `ErrorResponse` [#1698](https://github.com/yesodweb/yesod/pull/1698)
|
Document `ErrorResponse` [#1698](https://github.com/yesodweb/yesod/pull/1698)
|
||||||
|
|||||||
@ -1464,8 +1464,8 @@ respond ct = return . TypedContent ct . toContent
|
|||||||
|
|
||||||
-- | Use a @Source@ for the response body.
|
-- | Use a @Source@ for the response body.
|
||||||
--
|
--
|
||||||
-- Note that, for ease of use, the underlying monad is a @HandlerT@. This
|
-- Note that, for ease of use, the underlying monad is a @HandlerFor@. This
|
||||||
-- implies that you can run any @HandlerT@ action. However, since a streaming
|
-- implies that you can run any @HandlerFor@ action. However, since a streaming
|
||||||
-- response occurs after the response headers have already been sent, some
|
-- response occurs after the response headers have already been sent, some
|
||||||
-- actions make no sense here. For example: short-circuit responses, setting
|
-- actions make no sense here. For example: short-circuit responses, setting
|
||||||
-- headers, changing status codes, etc.
|
-- headers, changing status codes, etc.
|
||||||
@ -1476,8 +1476,8 @@ respondSource :: ContentType
|
|||||||
-> HandlerFor site TypedContent
|
-> HandlerFor site TypedContent
|
||||||
respondSource ctype src = HandlerFor $ \hd ->
|
respondSource ctype src = HandlerFor $ \hd ->
|
||||||
-- Note that this implementation relies on the fact that the ResourceT
|
-- Note that this implementation relies on the fact that the ResourceT
|
||||||
-- environment provided by the server is the same one used in HandlerT.
|
-- environment provided by the server is the same one used in HandlerFor.
|
||||||
-- This is a safe assumption assuming the HandlerT is run correctly.
|
-- This is a safe assumption assuming the HandlerFor is run correctly.
|
||||||
return $ TypedContent ctype $ ContentSource
|
return $ TypedContent ctype $ ContentSource
|
||||||
$ transPipe (lift . flip unHandlerFor hd) src
|
$ transPipe (lift . flip unHandlerFor hd) src
|
||||||
|
|
||||||
|
|||||||
@ -181,7 +181,7 @@ evalFallback contents val = catchAny
|
|||||||
(fmap ((mempty, ) . HCError) . toErrorHandler)
|
(fmap ((mempty, ) . HCError) . toErrorHandler)
|
||||||
|
|
||||||
-- | Function used internally by Yesod in the process of converting a
|
-- | Function used internally by Yesod in the process of converting a
|
||||||
-- 'HandlerT' into an 'Application'. Should not be needed by users.
|
-- 'HandlerFor' into an 'Application'. Should not be needed by users.
|
||||||
runHandler :: ToTypedContent c
|
runHandler :: ToTypedContent c
|
||||||
=> RunHandlerEnv site site
|
=> RunHandlerEnv site site
|
||||||
-> HandlerFor site c
|
-> HandlerFor site c
|
||||||
@ -216,26 +216,26 @@ safeEh log' er req = do
|
|||||||
(toContent ("Internal Server Error" :: S.ByteString))
|
(toContent ("Internal Server Error" :: S.ByteString))
|
||||||
(reqSession req)
|
(reqSession req)
|
||||||
|
|
||||||
-- | Run a 'HandlerT' completely outside of Yesod. This
|
-- | Run a 'HandlerFor' completely outside of Yesod. This
|
||||||
-- function comes with many caveats and you shouldn't use it
|
-- function comes with many caveats and you shouldn't use it
|
||||||
-- unless you fully understand what it's doing and how it works.
|
-- unless you fully understand what it's doing and how it works.
|
||||||
--
|
--
|
||||||
-- As of now, there's only one reason to use this function at
|
-- As of now, there's only one reason to use this function at
|
||||||
-- all: in order to run unit tests of functions inside 'HandlerT'
|
-- all: in order to run unit tests of functions inside 'HandlerFor'
|
||||||
-- but that aren't easily testable with a full HTTP request.
|
-- but that aren't easily testable with a full HTTP request.
|
||||||
-- Even so, it's better to use @wai-test@ or @yesod-test@ instead
|
-- Even so, it's better to use @wai-test@ or @yesod-test@ instead
|
||||||
-- of using this function.
|
-- of using this function.
|
||||||
--
|
--
|
||||||
-- This function will create a fake HTTP request (both @wai@'s
|
-- This function will create a fake HTTP request (both @wai@'s
|
||||||
-- 'Request' and @yesod@'s 'Request') and feed it to the
|
-- 'Request' and @yesod@'s 'Request') and feed it to the
|
||||||
-- @HandlerT@. The only useful information the @HandlerT@ may
|
-- @HandlerFor@. The only useful information the @HandlerFor@ may
|
||||||
-- get from the request is the session map, which you must supply
|
-- get from the request is the session map, which you must supply
|
||||||
-- as argument to @runFakeHandler@. All other fields contain
|
-- as argument to @runFakeHandler@. All other fields contain
|
||||||
-- fake information, which means that they can be accessed but
|
-- fake information, which means that they can be accessed but
|
||||||
-- won't have any useful information. The response of the
|
-- won't have any useful information. The response of the
|
||||||
-- @HandlerT@ is completely ignored, including changes to the
|
-- @HandlerFor@ is completely ignored, including changes to the
|
||||||
-- session, cookies or headers. We only return you the
|
-- session, cookies or headers. We only return you the
|
||||||
-- @HandlerT@'s return value.
|
-- @HandlerFor@'s return value.
|
||||||
runFakeHandler :: (Yesod site, MonadIO m) =>
|
runFakeHandler :: (Yesod site, MonadIO m) =>
|
||||||
SessionMap
|
SessionMap
|
||||||
-> (site -> Logger)
|
-> (site -> Logger)
|
||||||
|
|||||||
@ -231,7 +231,7 @@ data GHState = GHState
|
|||||||
|
|
||||||
-- | An extension of the basic WAI 'W.Application' datatype to provide extra
|
-- | An extension of the basic WAI 'W.Application' datatype to provide extra
|
||||||
-- features needed by Yesod. Users should never need to use this directly, as
|
-- features needed by Yesod. Users should never need to use this directly, as
|
||||||
-- the 'HandlerT' monad and template haskell code should hide it away.
|
-- the 'HandlerFor' monad and template haskell code should hide it away.
|
||||||
type YesodApp = YesodRequest -> ResourceT IO YesodResponse
|
type YesodApp = YesodRequest -> ResourceT IO YesodResponse
|
||||||
|
|
||||||
-- | A generic widget, allowing specification of both the subsite and master
|
-- | A generic widget, allowing specification of both the subsite and master
|
||||||
@ -473,7 +473,7 @@ instance MonadLogger (WidgetFor site) where
|
|||||||
instance MonadLoggerIO (WidgetFor site) where
|
instance MonadLoggerIO (WidgetFor site) where
|
||||||
askLoggerIO = WidgetFor $ return . rheLog . handlerEnv . wdHandler
|
askLoggerIO = WidgetFor $ return . rheLog . handlerEnv . wdHandler
|
||||||
|
|
||||||
-- Instances for HandlerT
|
-- Instances for HandlerFor
|
||||||
instance Applicative (HandlerFor site) where
|
instance Applicative (HandlerFor site) where
|
||||||
pure = HandlerFor . const . return
|
pure = HandlerFor . const . return
|
||||||
(<*>) = ap
|
(<*>) = ap
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
name: yesod-core
|
name: yesod-core
|
||||||
version: 1.6.18.5
|
version: 1.6.18.6
|
||||||
license: MIT
|
license: MIT
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
author: Michael Snoyman <michael@snoyman.com>
|
author: Michael Snoyman <michael@snoyman.com>
|
||||||
|
|||||||
@ -1,3 +1,7 @@
|
|||||||
|
## 1.6.0.1
|
||||||
|
|
||||||
|
* Update documentation from `HandlerT` to `HandlerFor` [#1703](https://github.com/yesodweb/yesod/pull/1703)
|
||||||
|
|
||||||
## 1.6.0
|
## 1.6.0
|
||||||
|
|
||||||
* Upgrade to yesod-core 1.6.0
|
* Upgrade to yesod-core 1.6.0
|
||||||
|
|||||||
@ -63,9 +63,9 @@ sourceToSource src =
|
|||||||
Just x -> yield (Chunk x) >> yield Flush
|
Just x -> yield (Chunk x) >> yield Flush
|
||||||
|
|
||||||
|
|
||||||
-- | Return a Server-Sent Event stream given a 'HandlerT' action
|
-- | Return a Server-Sent Event stream given a 'HandlerFor' action
|
||||||
-- that is repeatedly called. A state is threaded for the action
|
-- that is repeatedly called. A state is threaded for the action
|
||||||
-- so that it may avoid using @IORefs@. The @HandlerT@ action
|
-- so that it may avoid using @IORefs@. The @HandlerFor@ action
|
||||||
-- may sleep or block while waiting for more data. The HTTP
|
-- may sleep or block while waiting for more data. The HTTP
|
||||||
-- socket is flushed after every list of simultaneous events.
|
-- socket is flushed after every list of simultaneous events.
|
||||||
-- The connection is closed as soon as an 'ES.CloseEvent' is
|
-- The connection is closed as soon as an 'ES.CloseEvent' is
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
name: yesod-eventsource
|
name: yesod-eventsource
|
||||||
version: 1.6.0
|
version: 1.6.0.1
|
||||||
license: MIT
|
license: MIT
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
author: Felipe Lessa <felipe.lessa@gmail.com>
|
author: Felipe Lessa <felipe.lessa@gmail.com>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user