packages feed

servant-foreign 0.15.4 → 0.16.1

raw patch · 5 files changed

Files

CHANGELOG.md view
@@ -1,6 +1,13 @@ [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.16+----++- WithResource combinator for Servant-managed resources [#1630](https://github.com/haskell-servant/servant/pull/1630)++  For servant-foreign, this meant the addition of `HasForeign` instances.+ 0.15.4 ------ 
servant-foreign.cabal view
@@ -1,6 +1,6 @@-cabal-version:       >=1.10+cabal-version:       2.2 name:                servant-foreign-version:             0.15.4+version:             0.16.1  synopsis:            Helpers for generating clients for servant APIs in any programming language category:            Servant, Web@@ -15,13 +15,13 @@  homepage:            http://docs.servant.dev/ bug-reports:         http://github.com/haskell-servant/servant/issues-license:             BSD3+license:             BSD-3-Clause license-file:        LICENSE author:              Servant Contributors maintainer:          haskell-servant-maintainers@googlegroups.com copyright:           2015-2019 Servant Contributors build-type:          Simple-tested-with: GHC ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5 || ==8.8.4 || ==8.10.2 || ==9.0.1+tested-with: GHC ==8.10.7, GHC ==9.0.2, GHC ==9.2.8, GHC ==9.4.8, GHC ==9.6.4, GHC ==9.8.2, GHC ==9.10.1  extra-source-files:   CHANGELOG.md@@ -41,18 +41,18 @@   --   -- note: mtl lower bound is so low because of GHC-7.8   build-depends:-      base        >= 4.9     && < 4.16-    , text        >= 1.2.3.0 && < 1.3+      base        >= 4.14    && < 4.21+    , text        >= 1.2.3.0 && < 2.2    -- Servant dependencies   build-depends:-      servant            >=0.18 && <0.19+      servant            >=0.20.2 && <0.21    -- Other dependencies: Lower bound around what is in the latest Stackage LTS.   -- Here can be exceptions if we really need features from the newer versions.   build-depends:-      base-compat >= 0.10.5  && < 0.12-    , lens        >= 4.17    && < 5.1+      base-compat >= 0.10.5  && < 0.15+    , lens        >= 4.17    && < 5.4     , http-types  >= 0.12.2  && < 0.13    hs-source-dirs:      src@@ -74,7 +74,7 @@    -- Additional dependencies   build-depends:-    hspec >= 2.6.0 && <2.9+    hspec >= 2.6.0 && <2.12   build-tool-depends:-    hspec-discover:hspec-discover >=2.6.0 && <2.9+    hspec-discover:hspec-discover >=2.6.0 && <2.12   default-language:  Haskell2010
src/Servant/Foreign/Inflections.hs view
@@ -13,7 +13,6 @@ import           Control.Lens             hiding                  (cons) import qualified Data.Char                as C-import           Data.Monoid import           Data.Text                hiding                  (map) import           Prelude                  hiding
src/Servant/Foreign/Internal.hs view
@@ -22,9 +22,9 @@                  (Getter, makeLenses, makePrisms, (%~), (&), (.~), (<>~)) import           Data.Data                  (Data)+import           Data.Kind+                 (Type) import           Data.Proxy-import           Data.Semigroup-                 (Semigroup) import           Data.String import           Data.Text import           Data.Text.Encoding@@ -246,7 +246,7 @@ -- > -- > -- Or for example in case of lists -- > instance HasForeignType LangX Text a => HasForeignType LangX Text [a] where--- >    typeFor lang type _ = "listX of " <> typeFor lang ftype (Proxy :: Proxy a)+-- >    typeFor lang ftype _ = "listX of " <> typeFor lang ftype (Proxy :: Proxy a) -- -- Finally to generate list of information about all the endpoints for -- an API you create a function of a form:@@ -276,8 +276,8 @@ -- | Implementation of the Servant framework types. -- -- Relevant instances: Everything containing 'HasForeignType'.-class HasForeign lang ftype (api :: *) where-  type Foreign ftype api :: *+class HasForeign lang ftype (api :: Type) where+  type Foreign ftype api :: Type   foreignFor :: Proxy lang -> Proxy ftype -> Proxy api -> Req ftype -> Foreign ftype api  instance (HasForeign lang ftype a, HasForeign lang ftype b)@@ -489,6 +489,13 @@    foreignFor lang ftype Proxy = foreignFor lang ftype (Proxy :: Proxy api) +instance HasForeign lang ftype api =>+  HasForeign lang ftype (WithResource res :> api) where++  type Foreign ftype (WithResource res :> api) = Foreign ftype api++  foreignFor lang ftype Proxy = foreignFor lang ftype (Proxy :: Proxy api)+ instance HasForeign lang ftype api   => HasForeign lang ftype (HttpVersion :> api) where   type Foreign ftype (HttpVersion :> api) = Foreign ftype api@@ -509,6 +516,13 @@    foreignFor lang ftype Proxy req =     foreignFor lang ftype (Proxy :: Proxy api) req++instance HasForeign lang ftype (ToServantApi r) => HasForeign lang ftype (NamedRoutes r) where+  type Foreign ftype (NamedRoutes r) = Foreign ftype (ToServantApi r)++  foreignFor lang ftype Proxy req =+    foreignFor lang ftype (Proxy :: Proxy (ToServantApi r)) req+  -- | Utility class used by 'listFromAPI' which computes --   the data needed to generate a function for each endpoint
test/Servant/ForeignSpec.hs view
@@ -11,8 +11,6 @@  module Servant.ForeignSpec where -import           Data.Monoid-                 ((<>)) import           Data.Proxy import           Servant.Foreign import           Servant.Test.ComprehensiveAPI