From 8f01efd599892692bc03b9cac99fbfe78200e16a Mon Sep 17 00:00:00 2001 From: Matthias Fischmann Date: Mon, 12 Oct 2015 20:52:15 +0200 Subject: [PATCH] Export tweakResponse from non-internal module; better haddock comment. --- servant-server/src/Servant/Server.hs | 2 +- servant-server/src/Servant/Server/Internal/Router.hs | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/servant-server/src/Servant/Server.hs b/servant-server/src/Servant/Server.hs index 58c34ea3..2a886683 100644 --- a/servant-server/src/Servant/Server.hs +++ b/servant-server/src/Servant/Server.hs @@ -33,7 +33,7 @@ module Servant.Server , embedNat , squashNat , generalizeNat - + , tweakResponse -- * Default error type , ServantErr(..) diff --git a/servant-server/src/Servant/Server/Internal/Router.hs b/servant-server/src/Servant/Server/Internal/Router.hs index 653af681..89f7c144 100644 --- a/servant-server/src/Servant/Server/Internal/Router.hs +++ b/servant-server/src/Servant/Server/Internal/Router.hs @@ -26,9 +26,7 @@ data Router' a = -- ^ left-biased choice between two routers deriving Functor --- | Apply a function to the result of a router in functor style. The result contains the failure --- cases so one use case is to turn failures into middleware response values with appropriate status --- codes, message bodies, etc. +-- | Apply a transformation to the response of a `Router`. tweakResponse :: (RouteResult Response -> RouteResult Response) -> Router -> Router tweakResponse f = fmap (\a -> \req cont -> a req (cont . f))