| Copyright | (c) The University of Glasgow 2001 | 
|---|---|
| License | BSD-style (see the file LICENSE) | 
| Maintainer | Jeffrey Young <jeffrey.young@iohk.io> Luite Stegeman <luite.stegeman@iohk.io> Sylvain Henry <sylvain.henry@iohk.io> Josh Meredith <josh.meredith@iohk.io> | 
| Stability | experimental Module to deal with JS identifiers | 
| Safe Haskell | None | 
| Language | Haskell2010 | 
GHC.StgToJS.Ids
Description
Synopsis
- freshUnique :: G Int
 - freshIdent :: G Ident
 - makeIdentForId :: Id -> Maybe Int -> IdType -> Module -> Ident
 - cachedIdentForId :: Id -> Maybe Int -> IdType -> G Ident
 - identForId :: Id -> G Ident
 - identForIdN :: Id -> Int -> G Ident
 - identsForId :: Id -> G [Ident]
 - identForEntryId :: Id -> G Ident
 - identForDataConEntryId :: Id -> G Ident
 - identForDataConWorker :: DataCon -> G Ident
 - varForId :: Id -> G JExpr
 - varForIdN :: Id -> Int -> G JExpr
 - varsForId :: Id -> G [JExpr]
 - varForEntryId :: Id -> G JExpr
 - varForDataConEntryId :: Id -> G JExpr
 - varForDataConWorker :: DataCon -> G JExpr
 - declVarsForId :: Id -> G JStat
 
Documentation
freshUnique :: G Int Source #
Get fresh unique number
freshIdent :: G Ident Source #
Get fresh local Ident of the form: h$$unit:module_uniq
makeIdentForId :: Id -> Maybe Int -> IdType -> Module -> Ident Source #
Generate unique Ident for the given ID (uncached!)
The ident has the following forms:
global Id: h$unit:module.name[_num][_type_suffix] local Id: h$$unit:module.name[_num][_type_suffix]_uniq
Note that the string is z-encoded except for "_" delimiters.
Optional "_type_suffix" can be: - "_e" for IdEntry - "_con_e" for IdConEntry
Optional "_num" is passed as an argument to this function. It is used for Haskell Ids that require several JS variables: e.g. 64-bit numbers (Word64#, Int64#), Addr#, StablePtr#, unboxed tuples, etc.
cachedIdentForId :: Id -> Maybe Int -> IdType -> G Ident Source #
Retrieve the cached Ident for the given Id if there is one. Otherwise make
 a new one with makeIdentForId and cache it.
Helpers for Idents
identForIdN :: Id -> Int -> G Ident Source #
Retrieve default Ident for the given Id with sub index
Some types, Word64, Addr#, unboxed tuple have more than one corresponding JS var, hence we use the sub index to identify each subpart / JS variable.
identForDataConEntryId :: Id -> G Ident Source #
Retrieve datacon entry Ident for the given Id
Different name than the datacon wrapper.
identForDataConWorker :: DataCon -> G Ident Source #
Retrieve datacon worker entry variable name for the given datacon
Helpers for variables
varForIdN :: Id -> Int -> G JExpr Source #
Retrieve default variable name for the given Id with sub index