1{-# LANGUAGE PolyKinds #-}
2{-# LANGUAGE TypeFamilies #-}
3{-# LANGUAGE TypeOperators #-}
4{-# LANGUAGE ScopedTypeVariables #-}
5module Servant.API.Sub where
8import Data.String.Conversions
15-- | The contained API (second argument) can be found under @("/" ++ path)@
16-- (path being the first argument).
17data (path :: k) :> a = Proxy path :> a
20instance (KnownSymbol path, HasServer sublayout) => HasServer (path :> sublayout) where
21 type Server (path :> sublayout) = Server sublayout
22 route Proxy subserver request respond = case pathInfo request of
24 | first == cs (symbolVal proxyPath)
25 -> route (Proxy :: Proxy sublayout) subserver request{
30 where proxyPath = Proxy :: Proxy path
32instance (KnownSymbol path, HasClient sublayout) => HasClient (path :> sublayout) where
33 type Client (path :> sublayout) = Client sublayout
35 clientWithRoute Proxy req =
36 clientWithRoute (Proxy :: Proxy sublayout) $
39 where p = symbolVal (Proxy :: Proxy path)
41instance (KnownSymbol path, HasDocs sublayout) => HasDocs (path :> sublayout) where
43 docsFor Proxy (endpoint, action) =
44 docsFor sublayoutP (endpoint', action)
46 where sublayoutP = Proxy :: Proxy sublayout
47 endpoint' = endpoint & path <>~ symbolVal pa
48 pa = Proxy :: Proxy path
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