git.iko.soy/typeable/servant
on master help sign in
Fix javascript function name generation, mostly fixes #191

and remove js-specific code in servant-foreign (code which would now be dead)

commitc20c09411df06596592def6f9612c1bdf0be398c authorDario Bertini <berdario@gmail.com> dateSun 24 Jul 2016, 15:46 (10 years ago) parent094f28b
3 files changed+2−6
servant-foreign/src/Servant/Foreign/Inflections.hs+1−1 servant-foreign/src/Servant/Foreign/Internal.hs+1−3 servant-foreign/test/Servant/ForeignSpec.hs−2
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
@@ -19,8 +19,6 @@ camelCaseSpec = describe "camelCase" $ do
1919 it "converts FunctionNames to camelCase" $ do
2020 camelCase (FunctionName ["post", "counter", "inc"])
2121 `shouldBe` "postCounterInc"
22− camelCase (FunctionName ["get", "hyphen-ated", "counter"])
23− `shouldBe` "getHyphenatedCounter"
2422
2523----------------------------------------------------------------------
2624