Idris2Doc : Compiler.ES.State

Compiler.ES.State

(source)
State used during JS code generation and when
converting `NamedCExp` to imperative statements.

Definitions

error : String->Corea
  Convenient alias for `throw . InternalError`

Totality: total
Visibility: export
errorConcat : ListString->Corea
  Convenient alias for `error . fastConcat`.

Totality: total
Visibility: export
dataCGMode : Type
  Specifies the readability of the generated code.

In `Pretty` mode (the default), the codegen will
lift multiline lambdas from argument lists to the
surrounding scope and keep user generated names.
In addition, blocks of code are laid out with indentation
and linebreaks for better readability.

In `Compact` mode, all local variables are replace with
short machine generated ones, and every toplevel
function is printed on a single line without
line-breaks or indentation.

Finally, `Minimal` mode is like `Compact`, but toplevel
function names will be mangled and replaced with
machine generated indices.

Totality: total
Visibility: public export
Constructors:
Pretty : CGMode
Compact : CGMode
Minimal : CGMode
keepLocalName : Name->CGMode->Bool
  We only keep user defined local names and only so
in `Pretty` mode.

Totality: total
Visibility: export
keepRefName : Name->CGMode->Bool
  We mangle toplevel function names only in `Minimal` mode.

Totality: total
Visibility: export
dataESs : Type
Totality: total
Visibility: public export
recordESSt : Type
  Settings and state used during JS code generation.

Totality: total
Visibility: public export
Constructor: 
MkESSt : CGMode-> (Exp->Bool) -> (Exp->Bool) ->Int->Int->SortedMapNameMinimal->SortedMapNameVar->SortedMapStringString->ListString->NoMangleMap->ESSt

Projections:
.ccTypes : ESSt->ListString
  Accepted codegen types in foreign function definitions.
For JS, this is either `["node","javascript"]` or
`["browser","javascript"]`.
.isArg : ESSt->Exp->Bool
  Returns `True`, if the given expression can be used as an
argument in a function call. (If this returns `False`, the
given expression will be lifted to the surrounding scope
and bound to a new local variable).
.isFun : ESSt->Exp->Bool
  Returns `True`, if the given expression can be used directly
in a function application. (If this returns `False`, the
given expression will be lifted to the surrounding scope
and bound to a variable).
.loc : ESSt->Int
  Current local variable index
.locals : ESSt->SortedMapNameMinimal
  Mapping from local names to minimal expressions
.mode : ESSt->CGMode
  Whether to always use minimal names
.noMangleMap : ESSt->NoMangleMap
  %nomangle names
.preamble : ESSt->SortedMapStringString
  Mappings from name to definitions to be added
to the preamble.
.ref : ESSt->Int
  Current global variable index
.refs : ESSt->SortedMapNameVar
  Mapping from toplevel function names to variables
.mode : ESSt->CGMode
  Whether to always use minimal names

Totality: total
Visibility: public export
mode : ESSt->CGMode
  Whether to always use minimal names

Totality: total
Visibility: public export
.isArg : ESSt->Exp->Bool
  Returns `True`, if the given expression can be used as an
argument in a function call. (If this returns `False`, the
given expression will be lifted to the surrounding scope
and bound to a new local variable).

Totality: total
Visibility: public export
isArg : ESSt->Exp->Bool
  Returns `True`, if the given expression can be used as an
argument in a function call. (If this returns `False`, the
given expression will be lifted to the surrounding scope
and bound to a new local variable).

Totality: total
Visibility: public export
.isFun : ESSt->Exp->Bool
  Returns `True`, if the given expression can be used directly
in a function application. (If this returns `False`, the
given expression will be lifted to the surrounding scope
and bound to a variable).

Totality: total
Visibility: public export
isFun : ESSt->Exp->Bool
  Returns `True`, if the given expression can be used directly
in a function application. (If this returns `False`, the
given expression will be lifted to the surrounding scope
and bound to a variable).

Totality: total
Visibility: public export
.loc : ESSt->Int
  Current local variable index

Totality: total
Visibility: public export
loc : ESSt->Int
  Current local variable index

Totality: total
Visibility: public export
.ref : ESSt->Int
  Current global variable index

Totality: total
Visibility: public export
ref : ESSt->Int
  Current global variable index

Totality: total
Visibility: public export
.locals : ESSt->SortedMapNameMinimal
  Mapping from local names to minimal expressions

Totality: total
Visibility: public export
locals : ESSt->SortedMapNameMinimal
  Mapping from local names to minimal expressions

Totality: total
Visibility: public export
.refs : ESSt->SortedMapNameVar
  Mapping from toplevel function names to variables

Totality: total
Visibility: public export
refs : ESSt->SortedMapNameVar
  Mapping from toplevel function names to variables

Totality: total
Visibility: public export
.preamble : ESSt->SortedMapStringString
  Mappings from name to definitions to be added
to the preamble.

Totality: total
Visibility: public export
preamble : ESSt->SortedMapStringString
  Mappings from name to definitions to be added
to the preamble.

Totality: total
Visibility: public export
.ccTypes : ESSt->ListString
  Accepted codegen types in foreign function definitions.
For JS, this is either `["node","javascript"]` or
`["browser","javascript"]`.

Totality: total
Visibility: public export
ccTypes : ESSt->ListString
  Accepted codegen types in foreign function definitions.
For JS, this is either `["node","javascript"]` or
`["browser","javascript"]`.

Totality: total
Visibility: public export
.noMangleMap : ESSt->NoMangleMap
  %nomangle names

Totality: total
Visibility: public export
noMangleMap : ESSt->NoMangleMap
  %nomangle names

Totality: total
Visibility: public export
addLocal : RefESsESSt=>Name->Minimal->Core ()
  Map a local name to the given minimal expression

Totality: total
Visibility: export
nextLocal : RefESsESSt=>CoreVar
  Get and bump the local var index

Totality: total
Visibility: export
registerLocal : RefESsESSt=>Name->CoreVar
  Register a `Name` as a local variable. The name is kept
unchanged if `keepLocalName` returns `True` with the
current name and state, otherwise it is converted to
a new local variable.

Totality: total
Visibility: export
getOrRegisterLocal : RefESsESSt=>Name->CoreMinimal
  Look up a name and call `registerLocal` in case it has
not been added to the map of local names.

Totality: total
Visibility: export
projections : RefESsESSt=>Minimal->ListName->Core ()
  Maps the given list of names (from a pattern match
on a data constructor) to the corresponding
projections on the given scrutinee.

Totality: total
Visibility: export
addRef : RefESsESSt=>Name->Var->Core ()
  Map a toplevel function name to the given `Var`

Totality: total
Visibility: export
nextRef : RefESsESSt=>CoreVar
  Get and bump the local ref index

Totality: total
Visibility: export
getOrRegisterRef : RefESsESSt=>Name->CoreVar
  Look up a name and call `registerRef` in case it has
not been added to the map of toplevel function names.
The name will be replace with an index if the current
`GCMode` is set to `Minimal`.

Totality: total
Visibility: export
addToPreamble : RefESsESSt=>String->String->Core ()
  Add a new set of definitions under the given name to
the preamble. Fails with an error if a different set
of definitions have already been added under the same name.

Totality: total
Visibility: export
init : CGMode-> (Exp->Bool) -> (Exp->Bool) ->ListString->NoMangleMap->ESSt
  Initial state of the code generator

Totality: total
Visibility: export
reset : RefESsESSt=>Core ()
  Reset the local state before defining a new toplevel
function.

Totality: total
Visibility: export