hakaru-0.6.0: A probabilistic programming language

CopyrightCopyright (c) 2016 the Hakaru team
LicenseBSD3
Maintainerzsulliva@indiana.edu
Stabilityexperimental
PortabilityGHC-only This module provides a monad for C code generation as well
Safe HaskellNone
LanguageHaskell2010

Language.Hakaru.CodeGen.CodeGenMonad

Description

as some useful helper functions for manipulating it

Synopsis

Documentation

data CG Source #

Constructors

CG 

Fields

declare :: Sing (a :: Hakaru) -> Ident -> CodeGen () Source #

types like SData and SMeasure are impure in that they will produce extra code in the CodeGenMonad while literal types SReal, SInt, SNat, and SProb do not

extDeclareTypes :: Sing (a :: Hakaru) -> CodeGen () Source #

for types that contain subtypes we need to recursively traverse them and build up a list of external type declarations. For example: Measure (Array Nat) will need to have structures for arrays declared before the top level type

funCG :: [CTypeSpec] -> Ident -> [CDecl] -> CodeGen () -> CodeGen () Source #

ifCG :: CExpr -> CodeGen () -> CodeGen () -> CodeGen () Source #

forCG :: CExpr -> CExpr -> CExpr -> CodeGen () -> CodeGen () Source #

codeBlockCG :: CodeGen () -> CodeGen () Source #

Takes a cexpression for the location and size and a hakaru type, and generates a statement for allocating the memory