git.iko.soy/typeable/servant
on master help sign in
Merge pull request #668 from phadej/fix_js_function_identifiers
48014f4Oleg Grenrus
servant-foreign/CHANGELOG.md+6
@@ -1,3 +1,9 @@
1+0.10
2+----
3+
4+* Do not apply JavaScript specific mangling to the names.
5+ ([#191](https://github.com/haskell-servant/servant/issues/191))
6+
10.7.1
70.7.1
2-----
8-----
3
9
servant-foreign/src/Servant/Foreign/Inflections.hs+1−1
@@ -32,7 +32,7 @@ snakeCase :: FunctionName -> Text
32snakeCase = view snakeCaseL
32snakeCase = view snakeCaseL
33
33
34camelCaseL :: Getter FunctionName Text
34camelCaseL :: Getter FunctionName Text
35−camelCaseL = _FunctionName . to (convert . map (replace "-" ""))
35+camelCaseL = _FunctionName . to convert
36 where
36 where
37 convert [] = ""
37 convert [] = ""
38 convert (p:ps) = mconcat $ p : map capitalize ps
38 convert (p:ps) = mconcat $ p : map capitalize ps
servant-foreign/src/Servant/Foreign/Internal.hs+1−3
@@ -316,9 +316,7 @@ instance (KnownSymbol path, HasForeign lang ftype api)
316 req & reqUrl . path <>~ [Segment (Static (PathSegment str))]
316 req & reqUrl . path <>~ [Segment (Static (PathSegment str))]
317 & reqFuncName . _FunctionName %~ (++ [str])
317 & reqFuncName . _FunctionName %~ (++ [str])
318 where
318 where
319− str =
320− Data.Text.map (\c -> if c == '.' then '_' else c)
321− . pack . symbolVal $ (Proxy :: Proxy path)
319+ str = pack . symbolVal $ (Proxy :: Proxy path)
322
320
323instance HasForeign lang ftype api
321instance HasForeign lang ftype api
324 => HasForeign lang ftype (RemoteHost :> api) where
322 => HasForeign lang ftype (RemoteHost :> api) where
servant-foreign/test/Servant/ForeignSpec.hs+2−1
@@ -20,7 +20,8 @@ camelCaseSpec = describe "camelCase" $ do
20 camelCase (FunctionName ["post", "counter", "inc"])
20 camelCase (FunctionName ["post", "counter", "inc"])
21 `shouldBe` "postCounterInc"
21 `shouldBe` "postCounterInc"
22 camelCase (FunctionName ["get", "hyphen-ated", "counter"])
22 camelCase (FunctionName ["get", "hyphen-ated", "counter"])
23− `shouldBe` "getHyphenatedCounter"
23+ `shouldBe` "getHyphen-atedCounter"
24+
24
25
25----------------------------------------------------------------------
26----------------------------------------------------------------------
26
27