on develop help sign in
Ensuring uncommon character prefixes are handled gracefully
5d69fb4Brendan Hay
gen/src/Gen/Syntax.hs−1
@@ -50,7 +50,6 @@ scopeSig n = TypeSig noLoc [n] (TyCon "OAuthScope")
50scopeDecl :: Name -> Text -> Decl
50scopeDecl :: Name -> Text -> Decl
51scopeDecl n s = sfun noLoc n [] (UnGuardedRhs (str s)) noBinds
51scopeDecl n s = sfun noLoc n [] (UnGuardedRhs (str s)) noBinds
52
52
53− -- type API = :<|> ...
54apiAlias :: Name -> [Name] -> Decl
53apiAlias :: Name -> [Name] -> Decl
55apiAlias n ls = TypeDecl noLoc n [] alias
54apiAlias n ls = TypeDecl noLoc n [] alias
56 where
55 where
gen/src/Gen/Types/Id.hs+16−3
@@ -99,9 +99,22 @@ mname abrv (Suffix suf) (Global g) =
99 e = Text.replace "." "" abrv
99 e = Text.replace "." "" abrv
100 x:xs = map (upperAcronym . toPascal) g
100 x:xs = map (upperAcronym . toPascal) g
101
101
102−dname, cname :: Global -> Name
102+dname :: Global -> Name
103+dname = name
104+ . Text.unpack
103−dname = name . Text.unpack . renameReserved . upperHead . global
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
104−cname = name . Text.unpack . renameReserved . lowerHead . lowerFirstAcronym . global
116+ . lowerFirstAcronym
117+ . global
105
118
106bname :: Prefix -> Text -> Name
119bname :: Prefix -> Text -> Name
107bname (Prefix p) = name
120bname (Prefix p) = name