module Servant.Server.Internal.RoutingApplication where
import Network.Wai
(Application, Request, Response, ResponseReceived)
import Prelude ()
import Prelude.Compat
import Servant.Server.Internal.RouteResult
import Servant.Server.Internal.ServerError
type RoutingApplication =
Request
-> (RouteResult Response -> IO ResponseReceived) -> IO ResponseReceived
toApplication :: RoutingApplication -> Application
toApplication :: RoutingApplication -> Application
toApplication RoutingApplication
ra Request
request Response -> IO ResponseReceived
respond = RoutingApplication
ra Request
request RouteResult Response -> IO ResponseReceived
routingRespond
where
routingRespond :: RouteResult Response -> IO ResponseReceived
routingRespond :: RouteResult Response -> IO ResponseReceived
routingRespond (Fail ServerError
err) = Response -> IO ResponseReceived
respond forall a b. (a -> b) -> a -> b
$ ServerError -> Response
responseServerError ServerError
err
routingRespond (FailFatal ServerError
err) = Response -> IO ResponseReceived
respond forall a b. (a -> b) -> a -> b
$ ServerError -> Response
responseServerError ServerError
err
routingRespond (Route Response
v) = Response -> IO ResponseReceived
respond Response
v