@@ -226,6 +226,20 @@ safeLink _ endpoint = toLink endpoint (Link mempty mempty)
227-- Note that the @api@ type must be restricted to the endpoints that have
227-- Note that the @api@ type must be restricted to the endpoints that have
228-- valid links to them.
228-- valid links to them.
230+-- >>> type API = "foo" :> Capture "name" Text :> Get '[JSON] Text :<|> "bar" :> Capture "name" Int :> Get '[JSON] Double
231+-- >>> let fooLink :<|> barLink = allLinks (Proxy :: Proxy API)
233+-- fooLink :: Text -> Link
235+-- barLink :: Int -> Link
237+-- Note: nested APIs don't work well with this approach
239+-- >>> :kind! MkLink (Capture "nest" Char :> (Capture "x" Int :> Get '[JSON] Int :<|> Capture "y" Double :> Get '[JSON] Double))
240+-- MkLink (Capture "nest" Char :> (Capture "x" Int :> Get '[JSON] Int :<|> Capture "y" Double :> Get '[JSON] Double)) :: *
241+-- = Char -> (Int -> Link) :<|> (Double -> Link)
230 :: forall api. HasLink api
244 :: forall api. HasLink api
231 => Proxy api
245 => Proxy api
@@ -330,3 +344,4 @@ instance HasLink sub => HasLink (AuthProtect tag :> sub) where
332-- >>> import Servant.API
346-- >>> import Servant.API
347+-- >>> import Data.Text (Text)