diff --git a/servant-js/src/Servant/JS.hs b/servant-js/src/Servant/JS.hs index 2c9b0128..708847f3 100644 --- a/servant-js/src/Servant/JS.hs +++ b/servant-js/src/Servant/JS.hs @@ -145,8 +145,6 @@ writeJSForAPI :: (HasForeign api, GenerateList (Foreign api)) -> JavaScriptGenerator -- ^ js code generator to use (angular, vanilla js, jquery, others) -> FilePath -- ^ path to the file you want to write the resulting javascript code into -> IO () - --- TODO Data.Text writeJSForAPI p gen fp = writeFile fp (jsForAPI p gen) -- | Utility class used by 'jsForAPI' which computes diff --git a/servant-js/src/Servant/JS/Internal.hs b/servant-js/src/Servant/JS/Internal.hs index 2dd9f5de..2c7f84e7 100644 --- a/servant-js/src/Servant/JS/Internal.hs +++ b/servant-js/src/Servant/JS/Internal.hs @@ -89,9 +89,6 @@ defCommonGeneratorOptions = CommonGeneratorOptions -- -- @TODO: specify better default function name, or throw error? toValidFunctionName :: Text -> Text --- @TODO: Cons text --- - toValidFunctionName t = case T.uncons t of Just (x,xs) -> @@ -101,9 +98,7 @@ toValidFunctionName t = setFirstChar c = if firstChar c then c else '_' firstChar c = prefixOK c || any (Set.member c) firstLetterOK remainder c = prefixOK c || any (Set.member c) remainderOK - -- Valid prefixes prefixOK c = c `elem` ['$','_'] - -- Unicode character sets firstLetterOK = [ Set.lowercaseLetter , Set.uppercaseLetter , Set.titlecaseLetter @@ -115,28 +110,6 @@ toValidFunctionName t = , Set.spacingCombiningMark , Set.decimalNumber , Set.connectorPunctuation ] -{- -toValidFunctionName (x:xs) = [setFirstChar x] <> filter remainder xs - where - setFirstChar c = if firstChar c then c else '_' - firstChar c = prefixOK c || any (Set.member c) firstLetterOK - remainder c = prefixOK c || any (Set.member c) remainderOK - -- Valid prefixes - prefixOK c = c `elem` ['$','_'] - -- Unicode character sets - firstLetterOK = [ Set.lowercaseLetter - , Set.uppercaseLetter - , Set.titlecaseLetter - , Set.modifierLetter - , Set.otherLetter - , Set.letterNumber ] - remainderOK = firstLetterOK - <> [ Set.nonSpacingMark - , Set.spacingCombiningMark - , Set.decimalNumber - , Set.connectorPunctuation ] -toValidFunctionName [] = "_" --} toJSHeader :: HeaderArg -> Text toJSHeader (HeaderArg n) = toValidFunctionName ("header" <> n)