From e92bac08035eab156102c6183076bf3c602b2c7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Hahn?= Date: Tue, 25 Oct 2016 10:37:26 -0400 Subject: [PATCH] Switched order of type parameters --- .../Servant/Server/Utils/CustomCombinators.hs | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/servant-server/src/Servant/Server/Utils/CustomCombinators.hs b/servant-server/src/Servant/Server/Utils/CustomCombinators.hs index 3ca3d72c..a6ed78cb 100644 --- a/servant-server/src/Servant/Server/Utils/CustomCombinators.hs +++ b/servant-server/src/Servant/Server/Utils/CustomCombinators.hs @@ -39,14 +39,15 @@ import Servant.Server import Servant.Server.Internal data ServerCombinator combinator serverType api context where +data ServerCombinator combinator api context serverType where CI :: (forall env . Proxy (combinator :> api) -> Context context -> Delayed env serverType -> Router' env RoutingApplication) - -> ServerCombinator combinator serverType api context + -> ServerCombinator combinator api context serverType -runServerCombinator :: ServerCombinator combinator serverType api context +runServerCombinator :: ServerCombinator combinator api context serverType -> Proxy (combinator :> api) -> Context context -> Delayed env serverType @@ -69,14 +70,14 @@ runServerCombinator (CI i) = i makeCaptureCombinator :: (HasServer api context) => (Context context -> Text -> IO (RouteResult arg)) - -> ServerCombinator combinator (arg -> ServerT api Handler) api context + -> ServerCombinator combinator api context (arg -> ServerT api Handler) makeCaptureCombinator = inner -- we use 'inner' to avoid having 'forall' show up in haddock docs where inner :: forall api combinator arg context . (HasServer api context) => (Context context -> Text -> IO (RouteResult arg)) - -> ServerCombinator combinator (arg -> ServerT api Handler) api context + -> ServerCombinator combinator api context (arg -> ServerT api Handler) inner getArg = CI $ \ Proxy context delayed -> CaptureRouter $ route (Proxy :: Proxy api) context $ addCapture delayed $ \ captured -> @@ -96,14 +97,14 @@ makeCaptureCombinator = inner -- we use 'inner' to avoid having 'forall' show up makeRequestCheckCombinator :: (HasServer api context) => (Context context -> Request -> IO (RouteResult ())) - -> ServerCombinator combinator (ServerT api Handler) api context + -> ServerCombinator combinator api context (ServerT api Handler) makeRequestCheckCombinator = inner where inner :: forall api combinator context . (HasServer api context) => (Context context -> Request -> IO (RouteResult ())) - -> ServerCombinator combinator (ServerT api Handler) api context + -> ServerCombinator combinator api context (ServerT api Handler) inner check = CI $ \ Proxy context delayed -> route (Proxy :: Proxy api) context $ addMethodCheck delayed $ withRequest $ \ request -> @@ -112,14 +113,14 @@ makeRequestCheckCombinator = inner makeAuthCombinator :: (HasServer api context) => (Context context -> Request -> IO (RouteResult arg)) - -> ServerCombinator combinator (arg -> ServerT api Handler) api context + -> ServerCombinator combinator api context (arg -> ServerT api Handler) makeAuthCombinator = inner where inner :: forall api combinator arg context . (HasServer api context) => (Context context -> Request -> IO (RouteResult arg)) - -> ServerCombinator combinator (arg -> ServerT api Handler) api context + -> ServerCombinator combinator api context (arg -> ServerT api Handler) inner authCheck = CI $ \ Proxy context delayed -> route (Proxy :: Proxy api) context $ addAuthCheck delayed $ withRequest $ \ request -> @@ -128,14 +129,14 @@ makeAuthCombinator = inner makeCombinator :: (HasServer api context) => (Context context -> Request -> IO (RouteResult arg)) - -> ServerCombinator combinator (arg -> ServerT api Handler) api context + -> ServerCombinator combinator api context (arg -> ServerT api Handler) makeCombinator = inner where inner :: forall api combinator arg context . (HasServer api context) => (Context context -> Request -> IO (RouteResult arg)) - -> ServerCombinator combinator (arg -> ServerT api Handler) api context + -> ServerCombinator combinator api context (arg -> ServerT api Handler) inner getArg = CI $ \ Proxy context delayed -> route (Proxy :: Proxy api) context $ addBodyCheck delayed (return ())