Export tweakResponse from non-internal module; better haddock comment.

This commit is contained in:
Matthias Fischmann 2015-10-12 20:52:15 +02:00
parent dd1d30843b
commit 8f01efd599
2 changed files with 2 additions and 4 deletions

View file

@ -33,7 +33,7 @@ module Servant.Server
, embedNat , embedNat
, squashNat , squashNat
, generalizeNat , generalizeNat
, tweakResponse
-- * Default error type -- * Default error type
, ServantErr(..) , ServantErr(..)

View file

@ -26,9 +26,7 @@ data Router' a =
-- ^ left-biased choice between two routers -- ^ left-biased choice between two routers
deriving Functor deriving Functor
-- | Apply a function to the result of a router in functor style. The result contains the failure -- | Apply a transformation to the response of a `Router`.
-- cases so one use case is to turn failures into middleware response values with appropriate status
-- codes, message bodies, etc.
tweakResponse :: (RouteResult Response -> RouteResult Response) -> Router -> Router tweakResponse :: (RouteResult Response -> RouteResult Response) -> Router -> Router
tweakResponse f = fmap (\a -> \req cont -> a req (cont . f)) tweakResponse f = fmap (\a -> \req cont -> a req (cont . f))