Switched order of type parameters
This commit is contained in:
parent
775b239f7f
commit
e92bac0803
1 changed files with 11 additions and 10 deletions
|
@ -39,14 +39,15 @@ import Servant.Server
|
||||||
import Servant.Server.Internal
|
import Servant.Server.Internal
|
||||||
|
|
||||||
data ServerCombinator combinator serverType api context where
|
data ServerCombinator combinator serverType api context where
|
||||||
|
data ServerCombinator combinator api context serverType where
|
||||||
CI :: (forall env .
|
CI :: (forall env .
|
||||||
Proxy (combinator :> api)
|
Proxy (combinator :> api)
|
||||||
-> Context context
|
-> Context context
|
||||||
-> Delayed env serverType
|
-> Delayed env serverType
|
||||||
-> Router' env RoutingApplication)
|
-> 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)
|
-> Proxy (combinator :> api)
|
||||||
-> Context context
|
-> Context context
|
||||||
-> Delayed env serverType
|
-> Delayed env serverType
|
||||||
|
@ -69,14 +70,14 @@ runServerCombinator (CI i) = i
|
||||||
makeCaptureCombinator ::
|
makeCaptureCombinator ::
|
||||||
(HasServer api context) =>
|
(HasServer api context) =>
|
||||||
(Context context -> Text -> IO (RouteResult arg))
|
(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
|
makeCaptureCombinator = inner -- we use 'inner' to avoid having 'forall' show up in haddock docs
|
||||||
where
|
where
|
||||||
inner ::
|
inner ::
|
||||||
forall api combinator arg context .
|
forall api combinator arg context .
|
||||||
(HasServer api context) =>
|
(HasServer api context) =>
|
||||||
(Context context -> Text -> IO (RouteResult arg))
|
(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 ->
|
inner getArg = CI $ \ Proxy context delayed ->
|
||||||
CaptureRouter $
|
CaptureRouter $
|
||||||
route (Proxy :: Proxy api) context $ addCapture delayed $ \ captured ->
|
route (Proxy :: Proxy api) context $ addCapture delayed $ \ captured ->
|
||||||
|
@ -96,14 +97,14 @@ makeCaptureCombinator = inner -- we use 'inner' to avoid having 'forall' show up
|
||||||
makeRequestCheckCombinator ::
|
makeRequestCheckCombinator ::
|
||||||
(HasServer api context) =>
|
(HasServer api context) =>
|
||||||
(Context context -> Request -> IO (RouteResult ()))
|
(Context context -> Request -> IO (RouteResult ()))
|
||||||
-> ServerCombinator combinator (ServerT api Handler) api context
|
-> ServerCombinator combinator api context (ServerT api Handler)
|
||||||
makeRequestCheckCombinator = inner
|
makeRequestCheckCombinator = inner
|
||||||
where
|
where
|
||||||
inner ::
|
inner ::
|
||||||
forall api combinator context .
|
forall api combinator context .
|
||||||
(HasServer api context) =>
|
(HasServer api context) =>
|
||||||
(Context context -> Request -> IO (RouteResult ()))
|
(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 ->
|
inner check = CI $ \ Proxy context delayed ->
|
||||||
route (Proxy :: Proxy api) context $ addMethodCheck delayed $
|
route (Proxy :: Proxy api) context $ addMethodCheck delayed $
|
||||||
withRequest $ \ request ->
|
withRequest $ \ request ->
|
||||||
|
@ -112,14 +113,14 @@ makeRequestCheckCombinator = inner
|
||||||
makeAuthCombinator ::
|
makeAuthCombinator ::
|
||||||
(HasServer api context) =>
|
(HasServer api context) =>
|
||||||
(Context context -> Request -> IO (RouteResult arg))
|
(Context context -> Request -> IO (RouteResult arg))
|
||||||
-> ServerCombinator combinator (arg -> ServerT api Handler) api context
|
-> ServerCombinator combinator api context (arg -> ServerT api Handler)
|
||||||
makeAuthCombinator = inner
|
makeAuthCombinator = inner
|
||||||
where
|
where
|
||||||
inner ::
|
inner ::
|
||||||
forall api combinator arg context .
|
forall api combinator arg context .
|
||||||
(HasServer api context) =>
|
(HasServer api context) =>
|
||||||
(Context context -> Request -> IO (RouteResult arg))
|
(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 ->
|
inner authCheck = CI $ \ Proxy context delayed ->
|
||||||
route (Proxy :: Proxy api) context $ addAuthCheck delayed $
|
route (Proxy :: Proxy api) context $ addAuthCheck delayed $
|
||||||
withRequest $ \ request ->
|
withRequest $ \ request ->
|
||||||
|
@ -128,14 +129,14 @@ makeAuthCombinator = inner
|
||||||
makeCombinator ::
|
makeCombinator ::
|
||||||
(HasServer api context) =>
|
(HasServer api context) =>
|
||||||
(Context context -> Request -> IO (RouteResult arg))
|
(Context context -> Request -> IO (RouteResult arg))
|
||||||
-> ServerCombinator combinator (arg -> ServerT api Handler) api context
|
-> ServerCombinator combinator api context (arg -> ServerT api Handler)
|
||||||
makeCombinator = inner
|
makeCombinator = inner
|
||||||
where
|
where
|
||||||
inner ::
|
inner ::
|
||||||
forall api combinator arg context .
|
forall api combinator arg context .
|
||||||
(HasServer api context) =>
|
(HasServer api context) =>
|
||||||
(Context context -> Request -> IO (RouteResult arg))
|
(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 ->
|
inner getArg = CI $ \ Proxy context delayed ->
|
||||||
route (Proxy :: Proxy api) context $ addBodyCheck delayed
|
route (Proxy :: Proxy api) context $ addBodyCheck delayed
|
||||||
(return ())
|
(return ())
|
||||||
|
|
Loading…
Add table
Reference in a new issue