servant-foreign 0.10.1 → 0.10.2
raw patch · 3 files changed
+55/−32 lines, 3 filesdep ~servant
Dependency ranges changed: servant
Files
- CHANGELOG.md +13/−0
- servant-foreign.cabal +16/−8
- src/Servant/Foreign/Internal.hs +26/−24
CHANGELOG.md view
@@ -1,3 +1,16 @@+[The latest version of this document is on GitHub.](https://github.com/haskell-servant/servant/blob/master/servant-foreign/CHANGELOG.md)+[Changelog for `servant` package contains significant entries for all core packages.](https://github.com/haskell-servant/servant/blob/master/servant/CHANGELOG.md)++0.10.2+------++### Changes++* Add instances for `Description` and `Summary` combinators+ ([#767](https://github.com/haskell-servant/servant/pull/767))+* Derive Data for all types+ ([#809](https://github.com/haskell-servant/servant/pull/809))+ 0.10.1 ------
servant-foreign.cabal view
@@ -1,5 +1,5 @@ name: servant-foreign-version: 0.10.1+version: 0.10.2 synopsis: Helpers for generating clients for servant APIs in any programming language description: Helper types and functions for generating client functions for servant APIs in any programming language@@ -14,7 +14,7 @@ author: Servant Contributors maintainer: haskell-servant-maintainers@googlegroups.com copyright: 2015-2016 Servant Contributors-category: Servant Web+category: Servant, Web build-type: Simple cabal-version: >=1.10 extra-source-files:@@ -22,6 +22,12 @@ CHANGELOG.md README.md bug-reports: http://github.com/haskell-servant/servant/issues+tested-with:+ GHC==7.8.4+ GHC==7.10.3+ GHC==8.0.2+ GHC==8.2.1+ source-repository head type: git location: http://github.com/haskell-servant/servant.git@@ -32,7 +38,7 @@ , Servant.Foreign.Inflections build-depends: base == 4.* , lens == 4.*- , servant == 0.11.*+ , servant == 0.12.* , text >= 1.2 && < 1.3 , http-types hs-source-dirs: src@@ -41,21 +47,21 @@ if impl(ghc >= 8.0) ghc-options: -Wno-redundant-constraints include-dirs: include- default-extensions: CPP- , ConstraintKinds+ default-extensions: ConstraintKinds+ , CPP , DataKinds+ , DeriveDataTypeable , FlexibleContexts , FlexibleInstances , GeneralizedNewtypeDeriving , MultiParamTypeClasses+ , OverloadedStrings+ , PolyKinds , ScopedTypeVariables- , StandaloneDeriving , TemplateHaskell , TypeFamilies , TypeOperators , UndecidableInstances- , OverloadedStrings- , PolyKinds test-suite spec@@ -65,6 +71,8 @@ include-dirs: include main-is: Spec.hs other-modules: Servant.ForeignSpec+ build-tool-depends:+ hspec-discover:hspec-discover build-depends: base , hspec >= 2.1.8 , servant
src/Servant/Foreign/Internal.hs view
@@ -9,12 +9,14 @@ import Control.Lens (makePrisms, makeLenses, Getter, (&), (<>~), (%~), (.~))+import Data.Data (Data) #if !MIN_VERSION_base(4,8,0) import Data.Monoid #endif import Data.Proxy import Data.String import Data.Text+import Data.Typeable (Typeable) import Data.Text.Encoding (decodeUtf8) import GHC.TypeLits import qualified Network.HTTP.Types as HTTP@@ -24,21 +26,19 @@ newtype FunctionName = FunctionName { unFunctionName :: [Text] }- deriving (Show, Eq, Monoid)+ deriving (Data, Show, Eq, Monoid, Typeable) makePrisms ''FunctionName newtype PathSegment = PathSegment { unPathSegment :: Text }- deriving (Show, Eq, IsString, Monoid)+ deriving (Data, Show, Eq, IsString, Monoid, Typeable) makePrisms ''PathSegment data Arg f = Arg { _argName :: PathSegment , _argType :: f }--deriving instance Eq f => Eq (Arg f)-deriving instance Show f => Show (Arg f)+ deriving (Data, Eq, Show, Typeable) makeLenses ''Arg @@ -50,16 +50,12 @@ -- ^ a static path segment. like "/foo" | Cap (Arg f) -- ^ a capture. like "/:userid"--deriving instance Eq f => Eq (SegmentType f)-deriving instance Show f => Show (SegmentType f)+ deriving (Data, Eq, Show, Typeable) makePrisms ''SegmentType newtype Segment f = Segment { unSegment :: SegmentType f }--deriving instance Eq f => Eq (Segment f)-deriving instance Show f => Show (Segment f)+ deriving (Data, Eq, Show, Typeable) makePrisms ''Segment @@ -77,7 +73,7 @@ = Normal | Flag | List- deriving (Eq, Show)+ deriving (Data, Eq, Show, Typeable) makePrisms ''ArgType @@ -85,9 +81,7 @@ { _queryArgName :: Arg f , _queryArgType :: ArgType }--deriving instance Eq f => Eq (QueryArg f)-deriving instance Show f => Show (QueryArg f)+ deriving (Data, Eq, Show, Typeable) makeLenses ''QueryArg @@ -97,9 +91,7 @@ { _headerArg :: Arg f , _headerPattern :: Text }--deriving instance Eq f => Eq (HeaderArg f)-deriving instance Show f => Show (HeaderArg f)+ deriving (Data, Eq, Show, Typeable) makeLenses ''HeaderArg @@ -109,9 +101,7 @@ { _path :: Path f , _queryStr :: [QueryArg f] }--deriving instance Eq f => Eq (Url f)-deriving instance Show f => Show (Url f)+ deriving (Data, Eq, Show, Typeable) defUrl :: Url f defUrl = Url [] []@@ -126,9 +116,7 @@ , _reqReturnType :: Maybe f , _reqFuncName :: FunctionName }--deriving instance Eq f => Eq (Req f)-deriving instance Show f => Show (Req f)+ deriving (Data, Eq, Show, Typeable) makeLenses ''Req @@ -346,6 +334,20 @@ instance HasForeign lang ftype api => HasForeign lang ftype (HttpVersion :> api) where type Foreign ftype (HttpVersion :> api) = Foreign ftype api++ foreignFor lang ftype Proxy req =+ foreignFor lang ftype (Proxy :: Proxy api) req++instance HasForeign lang ftype api+ => HasForeign lang ftype (Summary desc :> api) where+ type Foreign ftype (Summary desc :> api) = Foreign ftype api++ foreignFor lang ftype Proxy req =+ foreignFor lang ftype (Proxy :: Proxy api) req++instance HasForeign lang ftype api+ => HasForeign lang ftype (Description desc :> api) where+ type Foreign ftype (Description desc :> api) = Foreign ftype api foreignFor lang ftype Proxy req = foreignFor lang ftype (Proxy :: Proxy api) req