GHC.StgToJS.DataCon

ghc-9.10.0.20240426: 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 | None
Language | GHC2021

GHC.StgToJS.DataCon

Description

Synopsis

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

# Documentation

genCon :: ExprCtx -> DataCon -> [JStgExpr] -> G JStgStat Source #

Generate a data constructor. Special handling for unboxed tuples

allocCon :: Ident -> DataCon -> CostCentreStack -> [JStgExpr] -> G JStgStat Source #

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

allocUnboxedCon :: DataCon -> [JStgExpr] -> JStgExpr 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
-> JStgExpr |
-> [JStgExpr] |
-> Maybe JStgExpr |
-> JStgExpr |

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

allocDynamic :: StgToJSConfig -> Bool -> Ident -> JStgExpr -> [JStgExpr] -> Maybe JStgExpr -> JStgStat Source #

Allocate a dynamic object