Canonicalize the API type to make sure that the following 'law' holds: Server (a :> (b :<|> c)) ~ Server (a :> b) :<|> Server (a :> c)
This commit is contained in:
parent
bd9d476679
commit
837099d12d
1 changed files with 1 additions and 2 deletions
|
@ -165,7 +165,6 @@ class HasServer layout where
|
|||
|
||||
type Server' layout = ServerT layout (EitherT (Int, String) IO)
|
||||
|
||||
|
||||
-- * Instances
|
||||
|
||||
-- | A server for @a ':<|>' b@ first tries to match the request against the route
|
||||
|
@ -184,7 +183,7 @@ instance (HasServer a, HasServer b) => HasServer (a :<|> b) where
|
|||
type ServerT (a :<|> b) m = ServerT a m :<|> ServerT b m
|
||||
|
||||
route Proxy (a :<|> b) request respond =
|
||||
route pa a request $ \ mResponse ->
|
||||
route pa a request $ \mResponse ->
|
||||
if isMismatch mResponse
|
||||
then route pb b request $ \mResponse' -> respond (mResponse <> mResponse')
|
||||
else respond mResponse
|
||||
|
|
Loading…
Reference in a new issue