@@ -47,6 +47,7 @@ module Servant.Foreign
49import Control.Lens (makeLenses, (%~), (&), (.~), (<>~))
49import Control.Lens (makeLenses, (%~), (&), (.~), (<>~))
50+import qualified Data.Char as C
50import Data.Proxy
51import Data.Proxy
51import Data.Text
52import Data.Text
52import GHC.Exts (Constraint)
53import GHC.Exts (Constraint)
@@ -66,10 +67,11 @@ snakeCase = intercalate "_"
66-- | Function name builder using the CamelCase convention.
67-- | Function name builder using the CamelCase convention.
67-- each part begins with an upper case character.
68-- each part begins with an upper case character.
68camelCase :: FunctionName -> Text
69camelCase :: FunctionName -> Text
69−camelCase [] = ""
70+camelCase = camelCase' . Prelude.map (replace "-" "")
71+ where camelCase' [] = ""
70−camelCase (p:ps) = concat $ p : camelCase' ps
72+ camelCase' (p:ps) = concat $ p : Prelude.map capitalize ps
71− where camelCase' [] = []
73+ capitalize "" = ""
72− camelCase' (r:rs) = toUpper r : camelCase' rs
74+ capitalize name = C.toUpper (Data.Text.head name) `cons` Data.Text.tail name
74type Arg = Text
76type Arg = Text