git.iko.soy/typeable/servant
on master help sign in
Remove redundant comments
984a76fArian van Putten
servant-js/src/Servant/JS.hs−2
@@ -145,8 +145,6 @@ writeJSForAPI :: (HasForeign api, GenerateList (Foreign api))
145 -> JavaScriptGenerator -- ^ js code generator to use (angular, vanilla js, jquery, others)
145 -> JavaScriptGenerator -- ^ js code generator to use (angular, vanilla js, jquery, others)
146 -> FilePath -- ^ path to the file you want to write the resulting javascript code into
146 -> FilePath -- ^ path to the file you want to write the resulting javascript code into
147 -> IO ()
147 -> IO ()
148−
149−-- TODO Data.Text
150writeJSForAPI p gen fp = writeFile fp (jsForAPI p gen)
148writeJSForAPI p gen fp = writeFile fp (jsForAPI p gen)
151
149
152-- | Utility class used by 'jsForAPI' which computes
150-- | Utility class used by 'jsForAPI' which computes
servant-js/src/Servant/JS/Internal.hs−27
@@ -89,9 +89,6 @@ defCommonGeneratorOptions = CommonGeneratorOptions
89--
89--
90-- @TODO: specify better default function name, or throw error?
90-- @TODO: specify better default function name, or throw error?
91toValidFunctionName :: Text -> Text
91toValidFunctionName :: Text -> Text
92−-- @TODO: Cons text
93−--
94−
95toValidFunctionName t =
92toValidFunctionName t =
96 case T.uncons t of
93 case T.uncons t of
97 Just (x,xs) ->
94 Just (x,xs) ->
@@ -101,29 +98,7 @@ toValidFunctionName t =
101 setFirstChar c = if firstChar c then c else '_'
98 setFirstChar c = if firstChar c then c else '_'
102 firstChar c = prefixOK c || any (Set.member c) firstLetterOK
99 firstChar c = prefixOK c || any (Set.member c) firstLetterOK
103 remainder c = prefixOK c || any (Set.member c) remainderOK
100 remainder c = prefixOK c || any (Set.member c) remainderOK
104− -- Valid prefixes
105− prefixOK c = c `elem` ['$','_']
106− -- Unicode character sets
107− firstLetterOK = [ Set.lowercaseLetter
108− , Set.uppercaseLetter
109− , Set.titlecaseLetter
110− , Set.modifierLetter
111− , Set.otherLetter
112− , Set.letterNumber ]
113− remainderOK = firstLetterOK
114− <> [ Set.nonSpacingMark
115− , Set.spacingCombiningMark
116− , Set.decimalNumber
117− , Set.connectorPunctuation ]
118−{-
119−toValidFunctionName (x:xs) = [setFirstChar x] <> filter remainder xs
120− where
121− setFirstChar c = if firstChar c then c else '_'
122− firstChar c = prefixOK c || any (Set.member c) firstLetterOK
123− remainder c = prefixOK c || any (Set.member c) remainderOK
124− -- Valid prefixes
125 prefixOK c = c `elem` ['$','_']
101 prefixOK c = c `elem` ['$','_']
126− -- Unicode character sets
127 firstLetterOK = [ Set.lowercaseLetter
102 firstLetterOK = [ Set.lowercaseLetter
128 , Set.uppercaseLetter
103 , Set.uppercaseLetter
129 , Set.titlecaseLetter
104 , Set.titlecaseLetter
@@ -135,8 +110,6 @@ toValidFunctionName (x:xs) = [setFirstChar x] <> filter remainder xs
135 , Set.spacingCombiningMark
110 , Set.spacingCombiningMark
136 , Set.decimalNumber
111 , Set.decimalNumber
137 , Set.connectorPunctuation ]
112 , Set.connectorPunctuation ]
138−toValidFunctionName [] = "_"
139−-}
140
113
141toJSHeader :: HeaderArg -> Text
114toJSHeader :: HeaderArg -> Text
142toJSHeader (HeaderArg n) = toValidFunctionName ("header" <> n)
115toJSHeader (HeaderArg n) = toValidFunctionName ("header" <> n)