Merge pull request #668 from phadej/fix_js_function_identifiers
Fix js function identifiers
commit48014f4a667e8b301d5d1f6f0ade7ea761a24aca
authorOleg Grenrus <oleg.grenrus@iki.fi>
dateMon 16 Jan 2017, 12:15 (10 years ago)
parent094f28b77f6910
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+
170.7.1
28-----
39
servant-foreign/src/Servant/Foreign/Inflections.hs+1−1
@@ -32,7 +32,7 @@ snakeCase :: FunctionName -> Text
3232snakeCase = view snakeCaseL
3333
3434camelCaseL :: Getter FunctionName Text
35−camelCaseL = _FunctionName . to (convert . map (replace "-" ""))
35+camelCaseL = _FunctionName . to convert
3636 where
3737 convert [] = ""
3838 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)
316316 req & reqUrl . path <>~ [Segment (Static (PathSegment str))]
317317 & reqFuncName . _FunctionName %~ (++ [str])
318318 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)
322320
323321instance HasForeign lang ftype api
324322 => HasForeign lang ftype (RemoteHost :> api) where
servant-foreign/test/Servant/ForeignSpec.hs+2−1
@@ -20,7 +20,8 @@ camelCaseSpec = describe "camelCase" $ do
2020 camelCase (FunctionName ["post", "counter", "inc"])
2121 `shouldBe` "postCounterInc"
2222 camelCase (FunctionName ["get", "hyphen-ated", "counter"])
23− `shouldBe` "getHyphenatedCounter"
23+ `shouldBe` "getHyphen-atedCounter"
24+
2425
2526----------------------------------------------------------------------
2627