on master help sign in
Initial support for matrix parameters. Not complete, not sure how to document them yet, since documentation is focused on endpoints, not individual path fragments.
6f10662Daniel Larsson
.gitignorenew file+17
@@ -0,0 +1,17 @@
1+dist
2+cabal-dev
3+*.o
4+*.hi
5+*.chi
6+*.chs.h
7+*.dyn_o
8+*.dyn_hi
9+.virtualenv
10+.hpc
11+.hsenv
12+.cabal-sandbox/
13+cabal.sandbox.config
14+cabal.config
15+*.prof
16+*.aux
17+*.hp
src/Servant/Docs.hs+37
@@ -556,6 +556,43 @@ instance (KnownSymbol sym, ToParam (QueryFlag sym), HasDocs sublayout)
556 paramP = Proxy :: Proxy (QueryFlag sym)
556 paramP = Proxy :: Proxy (QueryFlag sym)
557 action' = over params (|> toParam paramP) action
557 action' = over params (|> toParam paramP) action
558
558
559+
560+instance (KnownSymbol sym, {- ToParam (MatrixParam sym a), -} HasDocs sublayout)
561+ => HasDocs (MatrixParam sym a :> sublayout) where
562+
563+ docsFor Proxy (endpoint, action) =
564+ docsFor sublayoutP (endpoint', action)
565+
566+ where sublayoutP = Proxy :: Proxy sublayout
567+
568+ endpoint' = over path (\p -> p++";"++symbolVal symP) endpoint
569+ symP = Proxy :: Proxy sym
570+
571+
572+instance (KnownSymbol sym, {- ToParam (MatrixParams sym a), -} HasDocs sublayout)
573+ => HasDocs (MatrixParams sym a :> sublayout) where
574+
575+ docsFor Proxy (endpoint, action) =
576+ docsFor sublayoutP (endpoint', action)
577+
578+ where sublayoutP = Proxy :: Proxy sublayout
579+
580+ endpoint' = over path (\p -> p++";"++symbolVal symP) endpoint
581+ symP = Proxy :: Proxy sym
582+
583+
584+instance (KnownSymbol sym, {- ToParam (MatrixFlag sym), -} HasDocs sublayout)
585+ => HasDocs (MatrixFlag sym :> sublayout) where
586+
587+ docsFor Proxy (endpoint, action) =
588+ docsFor sublayoutP (endpoint', action)
589+
590+ where sublayoutP = Proxy :: Proxy sublayout
591+
592+ endpoint' = over path (\p -> p++";"++symbolVal symP) endpoint
593+ symP = Proxy :: Proxy sym
594+
595+
559instance HasDocs Raw where
596instance HasDocs Raw where
560 docsFor _proxy (endpoint, action) =
597 docsFor _proxy (endpoint, action) =
561 single endpoint action
598 single endpoint action