ghc-9.6.3: The GHC API

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 Code generation of data constructors
Safe Haskell | Safe-Inferred
Language | Haskell2010

GHC.StgToJS.DataCon

Description

Synopsis

- genCon :: ExprCtx -> DataCon -> [JExpr] -> G JStat
- allocCon :: Ident -> DataCon -> CostCentreStack -> [JExpr] -> G JStat
- allocUnboxedCon :: DataCon -> [JExpr] -> JExpr
- allocDynamicE :: Bool -> JExpr -> [JExpr] -> Maybe JExpr -> JExpr
- allocDynamic :: StgToJSConfig -> Bool -> Ident -> JExpr -> [JExpr] -> Maybe JExpr -> JStat

# Documentation

genCon :: ExprCtx -> DataCon -> [JExpr] -> G JStat Source #

Generate a data constructor. Special handling for unboxed tuples

allocCon :: Ident -> DataCon -> CostCentreStack -> [JExpr] -> G JStat Source #

Allocate a data constructor. Allocate in this context means bind the data constructor to `to`

allocUnboxedCon :: DataCon -> [JExpr] -> JExpr Source #

Allocate an unboxed data constructor. If we have a bool we calculate the right value. If not then we expect a singleton list and unbox by converting ''C x' to `x`. NB. This function may panic.

allocDynamicE Source #

Arguments

:: Bool | csInlineAlloc from StgToJSConfig
-> JExpr |
-> [JExpr] |
-> Maybe JExpr |
-> JExpr |

Allocate an entry function. See `hs` for the object layout.

allocDynamic :: StgToJSConfig -> Bool -> Ident -> JExpr -> [JExpr] -> Maybe JExpr -> JStat Source #

Allocate a dynamic object