commit ghc-servant-foreign for openSUSE:Factory
Hello community, here is the log from the commit of package ghc-servant-foreign for openSUSE:Factory checked in at 2017-08-31 20:59:18 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-servant-foreign (Old) and /work/SRC/openSUSE:Factory/.ghc-servant-foreign.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "ghc-servant-foreign" Thu Aug 31 20:59:18 2017 rev:2 rq:513487 version:0.10.1 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-servant-foreign/ghc-servant-foreign.changes 2017-05-09 18:08:58.151553090 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-servant-foreign.new/ghc-servant-foreign.changes 2017-08-31 20:59:20.879099766 +0200 @@ -1,0 +2,5 @@ +Thu Jul 27 14:08:14 UTC 2017 - psimons@suse.com + +- Update to version 0.10.1. + +------------------------------------------------------------------- Old: ---- servant-foreign-0.9.1.1.tar.gz New: ---- servant-foreign-0.10.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-servant-foreign.spec ++++++ --- /var/tmp/diff_new_pack.FocNTO/_old 2017-08-31 20:59:22.022939054 +0200 +++ /var/tmp/diff_new_pack.FocNTO/_new 2017-08-31 20:59:22.046935682 +0200 @@ -19,7 +19,7 @@ %global pkg_name servant-foreign %bcond_with tests Name: ghc-%{pkg_name} -Version: 0.9.1.1 +Version: 0.10.1 Release: 0 Summary: Helpers for generating clients for servant APIs in any programming language License: BSD-3-Clause ++++++ servant-foreign-0.9.1.1.tar.gz -> servant-foreign-0.10.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/servant-foreign-0.9.1.1/CHANGELOG.md new/servant-foreign-0.10.1/CHANGELOG.md --- old/servant-foreign-0.9.1.1/CHANGELOG.md 2016-10-24 17:04:42.000000000 +0200 +++ new/servant-foreign-0.10.1/CHANGELOG.md 2017-05-24 09:22:43.000000000 +0200 @@ -1,3 +1,20 @@ +0.10.1 +------ + +### Changes + +* Don't drop samples in `HasDocs ReqBody` instance + ([#755](https://github.com/haskell-servant/servant/pull/755/files)). + *Breaking change in an `Internal` module*. + +0.10 +---- + +### Breaking changes + +* Do not apply JavaScript specific mangling to the names. + ([#191](https://github.com/haskell-servant/servant/issues/191)) + 0.7.1 ----- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/servant-foreign-0.9.1.1/servant-foreign.cabal new/servant-foreign-0.10.1/servant-foreign.cabal --- old/servant-foreign-0.9.1.1/servant-foreign.cabal 2016-10-27 13:25:27.000000000 +0200 +++ new/servant-foreign-0.10.1/servant-foreign.cabal 2017-05-24 09:22:43.000000000 +0200 @@ -1,5 +1,5 @@ name: servant-foreign -version: 0.9.1.1 +version: 0.10.1 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: Web +category: Servant Web build-type: Simple cabal-version: >=1.10 extra-source-files: @@ -32,7 +32,7 @@ , Servant.Foreign.Inflections build-depends: base == 4.* , lens == 4.* - , servant == 0.9.* + , servant == 0.11.* , text >= 1.2 && < 1.3 , http-types hs-source-dirs: src @@ -67,6 +67,7 @@ other-modules: Servant.ForeignSpec build-depends: base , hspec >= 2.1.8 + , servant , servant-foreign default-language: Haskell2010 default-extensions: ConstraintKinds diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/servant-foreign-0.9.1.1/src/Servant/Foreign/Inflections.hs new/servant-foreign-0.10.1/src/Servant/Foreign/Inflections.hs --- old/servant-foreign-0.9.1.1/src/Servant/Foreign/Inflections.hs 2016-10-24 17:04:42.000000000 +0200 +++ new/servant-foreign-0.10.1/src/Servant/Foreign/Inflections.hs 2017-05-24 09:22:43.000000000 +0200 @@ -32,7 +32,7 @@ snakeCase = view snakeCaseL camelCaseL :: Getter FunctionName Text -camelCaseL = _FunctionName . to (convert . map (replace "-" "")) +camelCaseL = _FunctionName . to convert where convert [] = "" convert (p:ps) = mconcat $ p : map capitalize ps diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/servant-foreign-0.9.1.1/src/Servant/Foreign/Internal.hs new/servant-foreign-0.10.1/src/Servant/Foreign/Internal.hs --- old/servant-foreign-0.9.1.1/src/Servant/Foreign/Internal.hs 2016-10-24 17:04:42.000000000 +0200 +++ new/servant-foreign-0.10.1/src/Servant/Foreign/Internal.hs 2017-05-24 09:22:43.000000000 +0200 @@ -16,11 +16,11 @@ import Data.String import Data.Text import Data.Text.Encoding (decodeUtf8) -import GHC.Exts (Constraint) import GHC.TypeLits import qualified Network.HTTP.Types as HTTP import Prelude hiding (concat) import Servant.API +import Servant.API.TypeLevel newtype FunctionName = FunctionName { unFunctionName :: [Text] } @@ -135,15 +135,6 @@ defReq :: Req ftype defReq = Req defUrl "GET" [] Nothing Nothing (FunctionName []) --- | To be used exclusively as a "negative" return type/constraint --- by @'Elem`@ type family. -class NotFound - -type family Elem (a :: *) (ls::[*]) :: Constraint where - Elem a '[] = NotFound - Elem a (a ': list) = () - Elem a (b ': list) = Elem a list - -- | 'HasForeignType' maps Haskell types with types in the target -- language of your backend. For example, let's say you're -- implementing a backend to some language __X__, and you want @@ -196,9 +187,16 @@ foreignFor lang ftype (Proxy :: Proxy a) req :<|> foreignFor lang ftype (Proxy :: Proxy b) req +data EmptyForeignAPI = EmptyForeignAPI + +instance HasForeign lang ftype EmptyAPI where + type Foreign ftype EmptyAPI = EmptyForeignAPI + + foreignFor Proxy Proxy Proxy _ = EmptyForeignAPI + instance (KnownSymbol sym, HasForeignType lang ftype t, HasForeign lang ftype api) => HasForeign lang ftype (Capture sym t :> api) where - type Foreign ftype (Capture sym a :> api) = Foreign ftype api + type Foreign ftype (Capture sym t :> api) = Foreign ftype api foreignFor lang Proxy Proxy req = foreignFor lang Proxy (Proxy :: Proxy api) $ @@ -316,9 +314,7 @@ req & reqUrl . path <>~ [Segment (Static (PathSegment str))] & reqFuncName . _FunctionName %~ (++ [str]) where - str = - Data.Text.map (\c -> if c == '.' then '_' else c) - . pack . symbolVal $ (Proxy :: Proxy path) + str = pack . symbolVal $ (Proxy :: Proxy path) instance HasForeign lang ftype api => HasForeign lang ftype (RemoteHost :> api) where @@ -360,6 +356,9 @@ class GenerateList ftype reqs where generateList :: reqs -> [Req ftype] +instance GenerateList ftype EmptyForeignAPI where + generateList _ = [] + instance GenerateList ftype (Req ftype) where generateList r = [r] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/servant-foreign-0.9.1.1/test/Servant/ForeignSpec.hs new/servant-foreign-0.10.1/test/Servant/ForeignSpec.hs --- old/servant-foreign-0.9.1.1/test/Servant/ForeignSpec.hs 2016-10-24 17:04:42.000000000 +0200 +++ new/servant-foreign-0.10.1/test/Servant/ForeignSpec.hs 2017-05-24 09:22:43.000000000 +0200 @@ -6,9 +6,11 @@ import Data.Monoid ((<>)) import Data.Proxy import Servant.Foreign +import Servant.API.Internal.Test.ComprehensiveAPI import Test.Hspec + spec :: Spec spec = describe "Servant.Foreign" $ do camelCaseSpec @@ -20,7 +22,12 @@ camelCase (FunctionName ["post", "counter", "inc"]) `shouldBe` "postCounterInc" camelCase (FunctionName ["get", "hyphen-ated", "counter"]) - `shouldBe` "getHyphenatedCounter" + `shouldBe` "getHyphen-atedCounter" + +---------------------------------------------------------------------- + +-- This declaration simply checks that all instances are in place. +_ = listFromAPI (Proxy :: Proxy LangX) (Proxy :: Proxy String) comprehensiveAPIWithoutRaw ---------------------------------------------------------------------- @@ -29,6 +36,9 @@ instance HasForeignType LangX String NoContent where typeFor _ _ _ = "voidX" +instance HasForeignType LangX String (Headers ctyps NoContent) where + typeFor _ _ _ = "voidX" + instance HasForeignType LangX String Int where typeFor _ _ _ = "intX" @@ -47,13 +57,14 @@ :<|> "test" :> QueryParams "params" Int :> ReqBody '[JSON] String :> Put '[JSON] NoContent :<|> "test" :> Capture "id" Int :> Delete '[JSON] NoContent :<|> "test" :> CaptureAll "ids" Int :> Get '[JSON] [Int] + :<|> "test" :> EmptyAPI testApi :: [Req String] testApi = listFromAPI (Proxy :: Proxy LangX) (Proxy :: Proxy String) (Proxy :: Proxy TestApi) listFromAPISpec :: Spec listFromAPISpec = describe "listFromAPI" $ do - it "generates 4 endpoints for TestApi" $ do + it "generates 5 endpoints for TestApi" $ do length testApi `shouldBe` 5 let [getReq, postReq, putReq, deleteReq, captureAllReq] = testApi
participants (1)
-
root@hilbert.suse.de