on develop help sign in
Ensuring uncommon character prefixes are handled gracefully
commit5d69fb4973bef9eaea008ddad98eae90ac511e53 authorBrendan Hay <brendan.g.hay@gmail.com> dateFri 18 Mar 2016, 16:11 (11 years ago) parent3d73563
2 files changed+16−4
gen/src/Gen/Syntax.hs−1 gen/src/Gen/Types/Id.hs+16−3
gen/src/Gen/Syntax.hs−1
@@ -50,7 +50,6 @@ scopeSig n = TypeSig noLoc [n] (TyCon "OAuthScope")
5050scopeDecl :: Name -> Text -> Decl
5151scopeDecl n s = sfun noLoc n [] (UnGuardedRhs (str s)) noBinds
5252
53− -- type API = :<|> ...
5453apiAlias :: Name -> [Name] -> Decl
5554apiAlias n ls = TypeDecl noLoc n [] alias
5655 where
gen/src/Gen/Types/Id.hs+16−3
@@ -99,9 +99,22 @@ mname abrv (Suffix suf) (Global g) =
9999 e = Text.replace "." "" abrv
100100 x:xs = map (upperAcronym . toPascal) g
101101
102−dname, cname :: Global -> Name
103−dname = name . Text.unpack . renameReserved . upperHead . global
104−cname = name . Text.unpack . renameReserved . lowerHead . lowerFirstAcronym . global
102+dname :: Global -> Name
103+dname = name
104+ . Text.unpack
105+ . renameReserved
106+ . upperHead
107+ . Text.dropWhile separator
108+ . global
109+
110+cname :: Global -> Name
111+cname = name
112+ . Text.unpack
113+ . renameReserved
114+ . lowerHead
115+ . Text.dropWhile separator
116+ . lowerFirstAcronym
117+ . global
105118
106119bname :: Prefix -> Text -> Name
107120bname (Prefix p) = name