packages feed

servant-foreign 0.9.1.1 → 0.10

raw patch · 5 files changed

+26/−18 lines, 5 filesdep ~servantnew-uploader

Dependency ranges changed: servant

Files

CHANGELOG.md view
@@ -1,3 +1,11 @@+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 ----- 
servant-foreign.cabal view
@@ -1,5 +1,5 @@ name:                servant-foreign-version:             0.9.1.1+version:             0.10 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.10.*                      , 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
src/Servant/Foreign/Inflections.hs view
@@ -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
src/Servant/Foreign/Internal.hs view
@@ -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@@ -316,9 +307,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
test/Servant/ForeignSpec.hs view
@@ -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,13 +22,21 @@     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++----------------------------------------------------------------------+ data LangX  instance HasForeignType LangX String NoContent where+  typeFor _ _ _ = "voidX"++instance HasForeignType LangX String (Headers ctyps NoContent) where   typeFor _ _ _ = "voidX"  instance HasForeignType LangX String Int where