1{-# LANGUAGE TypeFamilies #-}
2{-# LANGUAGE TypeOperators #-}
3{-# LANGUAGE ScopedTypeVariables #-}
4module Servant.API.Union where
11-- | Union of two APIs, first takes precedence in case of overlap.
12data a :<|> b = a :<|> b
15instance (HasServer a, HasServer b) => HasServer (a :<|> b) where
16 type Server (a :<|> b) = Server a :<|> Server b
17 route Proxy (a :<|> b) globalPathInfo request respond = do
18 route (Proxy :: Proxy a) a globalPathInfo request $ \ mResponse ->
20 Nothing -> route (Proxy :: Proxy b) b globalPathInfo request respond
21 Just resp -> respond $ Just resp
23instance (HasClient a, HasClient b) => HasClient (a :<|> b) where
24 type Client (a :<|> b) = Client a :<|> Client b
25 clientWithRoute Proxy req =
26 clientWithRoute (Proxy :: Proxy a) req :<|>
27 clientWithRoute (Proxy :: Proxy b) req
29instance (HasDocs layout1, HasDocs layout2)
30 => HasDocs (layout1 :<|> layout2) where
32 docsFor Proxy (ep, action) = docsFor p1 (ep, action) <> docsFor p2 (ep, action)
34 where p1 :: Proxy layout1
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list