purescript-0.5.2.5: PureScript Programming Language Compiler

Safe HaskellSafe-Inferred

Language.PureScript.CodeGen.Common

Description

Common code generation utility functions

Synopsis

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.

isIdent :: String -> BoolSource

Test if a string is a valid JS identifier (may return false negatives)