servant-docs 0.9.1.1 → 0.10
raw patch · 3 files changed
+24/−17 lines, 3 filesdep +base-compatdep +semigroupsdep ~servantnew-uploader
Dependencies added: base-compat, semigroups
Dependency ranges changed: servant
Files
- CHANGELOG.md +5/−0
- servant-docs.cabal +7/−3
- src/Servant/Docs/Internal.hs +12/−14
CHANGELOG.md view
@@ -1,3 +1,8 @@+0.10+----++There are no changes. Released as a part of `servant` suite.+ 0.7.1 -----
servant-docs.cabal view
@@ -1,5 +1,5 @@ name: servant-docs-version: 0.9.1.1+version: 0.10 synopsis: generate API docs for your servant webservice description: Library for generating API docs from a servant API definition.@@ -12,7 +12,7 @@ author: Servant Contributors maintainer: haskell-servant-maintainers@googlegroups.com copyright: 2014-2016 Zalora South East Asia Pte Ltd, Servant Contributors-category: Web+category: Servant Web build-type: Simple cabal-version: >=1.10 tested-with: GHC >= 7.8@@ -33,6 +33,7 @@ , Servant.Docs.Internal.Pretty build-depends: base >=4.7 && <5+ , base-compat >= 0.9.1 && <0.10 , aeson , aeson-pretty , bytestring@@ -41,11 +42,14 @@ , http-media >= 0.6 , http-types >= 0.7 , lens- , servant == 0.9.*+ , servant == 0.10.* , string-conversions , text , unordered-containers , control-monad-omega == 0.3.*+ if !impl(ghc >= 8.0)+ build-depends:+ semigroups >=0.16.2.2 && <0.19 hs-source-dirs: src default-language: Haskell2010 ghc-options: -Wall
src/Servant/Docs/Internal.hs view
@@ -20,6 +20,8 @@ #include "overlapping-compat.h" module Servant.Docs.Internal where +import Prelude ()+import Prelude.Compat import Control.Applicative import Control.Arrow (second) import Control.Lens (makeLenses, mapped, over, traversed, view, (%~),@@ -30,19 +32,19 @@ import qualified Data.CaseInsensitive as CI import Data.Hashable (Hashable) import Data.HashMap.Strict (HashMap)-import Data.List+import Data.List.Compat (intercalate, intersperse, sort) import Data.Maybe-import Data.Monoid+import Data.Monoid (All (..), Any (..), Sum (..), Product (..), First (..), Last (..), Dual (..))+import Data.Semigroup (Semigroup (..)) import Data.Ord (comparing) import Data.Proxy (Proxy(Proxy)) import Data.String.Conversions (cs) import Data.Text (Text, unpack)-import GHC.Exts (Constraint) import GHC.Generics import GHC.TypeLits import Servant.API import Servant.API.ContentTypes-import Servant.Utils.Links+import Servant.API.TypeLevel import qualified Data.HashMap.Strict as HM import qualified Data.Text as T@@ -103,8 +105,11 @@ , _apiEndpoints :: HashMap Endpoint Action } deriving (Eq, Show) +instance Semigroup API where+ (<>) = mappend+ instance Monoid API where- API a1 b1 `mappend` API a2 b2 = API (a1 <> a2) (b1 <> b2)+ API a1 b1 `mappend` API a2 b2 = API (a1 `mappend` a2) (b1 `mappend` b2) mempty = API mempty mempty -- | An empty 'API'@@ -163,6 +168,8 @@ -- These are intended to be built using extraInfo. -- Multiple ExtraInfo may be combined with the monoid instance. newtype ExtraInfo api = ExtraInfo (HashMap Endpoint Action)+instance Semigroup (ExtraInfo a) where+ (<>) = mappend instance Monoid (ExtraInfo a) where mempty = ExtraInfo mempty ExtraInfo a `mappend` ExtraInfo b =@@ -305,15 +312,6 @@ -- | Generate the docs for a given API that implements 'HasDocs'. docsWithOptions :: HasDocs api => Proxy api -> DocOptions -> API docsWithOptions p = docsFor p (defEndpoint, defAction)---- | Closed type family, check if endpoint is exactly within API.---- We aren't sure what affects how an Endpoint is built up, so we require an--- exact match.-type family IsIn (endpoint :: *) (api :: *) :: Constraint where- IsIn e (sa :<|> sb) = Or (IsIn e sa) (IsIn e sb)- IsIn (e :> sa) (e :> sb) = IsIn sa sb- IsIn e e = () -- | Create an 'ExtraInfo' that is guaranteed to be within the given API layout. --