Safe Haskell | None |
---|---|
Language | Haskell98 |
Common code generation utility functions
- moduleNameToJs :: ModuleName -> String
- identToJs :: Ident -> String
- identNeedsEscaping :: String -> Bool
- identCharToString :: Char -> String
- nameIsJsReserved :: String -> Bool
- nameIsJsBuiltIn :: String -> Bool
- jsAnyReserved :: [String]
- jsKeywords :: [String]
- jsSometimesReserved :: [String]
- jsFutureReserved :: [String]
- jsFutureReservedStrict :: [String]
- jsOldReserved :: [String]
- jsLiterals :: [String]
Documentation
moduleNameToJs :: ModuleName -> String Source
identToJs :: Ident -> String Source
Convert an Ident into a valid Javascript identifier:
- Alphanumeric characters are kept unmodified.
- Reserved javascript identifiers are prefixed with
$$
. - Symbols are prefixed with
$
followed by a symbol name or their ordinal value.
identNeedsEscaping :: String -> Bool Source
Test if a string is a valid JS identifier without escaping.
identCharToString :: Char -> String Source
Attempts to find a human-readable name for a symbol, if none has been specified returns the ordinal value.
nameIsJsReserved :: String -> Bool Source
Checks whether an identifier name is reserved in Javascript.
nameIsJsBuiltIn :: String -> Bool Source
Checks whether a name matches a built-in value in Javascript.
jsAnyReserved :: [String] Source
jsKeywords :: [String] Source
jsFutureReserved :: [String] Source
jsOldReserved :: [String] Source
jsLiterals :: [String] Source