Safe Haskell | Safe-Inferred |
---|
Common code generation utility functions
- identToJs :: Ident -> String
- identCharToString :: Char -> String
- nameIsJsReserved :: String -> Bool
- isIdent :: String -> Bool
- moduleNameToJs :: ModuleName -> String
Documentation
identToJs :: Ident -> StringSource
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.
identCharToString :: Char -> StringSource
Attempts to find a human-readable name for a symbol, if none has been specified returns the ordinal value.
nameIsJsReserved :: String -> BoolSource
Checks whether an identifier name is reserved in Javascript.