1{-# LANGUAGE PolyKinds #-}
2{-# LANGUAGE TypeFamilies #-}
3{-# LANGUAGE TypeOperators #-}
4{-# LANGUAGE FlexibleContexts #-}
5{-# LANGUAGE FlexibleInstances #-}
6{-# LANGUAGE ScopedTypeVariables #-}
7module Servant.API.Capture where
22captured :: FromText a => proxy (Capture sym a) -> Text -> Maybe a
25instance (KnownSymbol capture, FromText a, HasServer sublayout)
26 => HasServer (Capture capture a :> sublayout) where
28 type Server (Capture capture a :> sublayout) =
31 route Proxy subserver request respond = case pathInfo request of
33 -> case captured captureProxy first of
34 Nothing -> respond Nothing
35 Just v -> route (Proxy :: Proxy sublayout) (subserver v) request{
40 where captureProxy = Proxy :: Proxy (Capture capture a)
42instance (KnownSymbol capture, ToText a, HasClient sublayout)
43 => HasClient (Capture capture a :> sublayout) where
45 type Client (Capture capture a :> sublayout) =
48 clientWithRoute Proxy req val =
49 clientWithRoute (Proxy :: Proxy sublayout) $
52 where p = unpack (toText val)
54instance (KnownSymbol sym, ToCapture (Capture sym a), HasDocs sublayout)
55 => HasDocs (Capture sym a :> sublayout) where
57 docsFor Proxy (endpoint, action) =
58 docsFor sublayoutP (endpoint', action')
60 where sublayoutP = Proxy :: Proxy sublayout
61 captureP = Proxy :: Proxy (Capture sym a)
63 action' = over captures (|> toCapture captureP) action
64 endpoint' = over path (\p -> p++"/:"++symbolVal symP) endpoint
65 symP = Proxy :: Proxy sym
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