ivory-0.1.0.3: Safe embedded C programming.

Safe HaskellNone
LanguageHaskell2010

Ivory.Language.Init

Synopsis

Documentation

data XInit Source

Intermediate initializer type supporting compound initializers. The IFresh nodes are flattened into multiple I.Init nodes in a FreshName monad when the variable is allocated.

initType :: XInit -> Type Source

Return the type of the initializer.

newtype Init area Source

Constructors

Init 

Fields

getInit :: XInit
 

class IvoryZero area where Source

Zero initializers. The semantics of Ivory is that initializers must be compatible with C semantics of initializing to 0 for globals in .bss.

Methods

izero :: Init area Source

Instances

IvoryStruct sym => IvoryZero (Struct * sym) Source 
IvoryZeroVal a => IvoryZero (Stored * a) Source 
(IvoryZero area, IvoryArea area, ANat len) => IvoryZero (Array * len area) Source 

class Monad m => FreshName m where Source

Methods

freshName :: String -> m Var Source

data Binding Source

A variable binding (on the stack or in a memory area).

Constructors

Binding 

Instances

runInit :: FreshName m => XInit -> m (Init, [Binding]) Source

Return the initializer and auxillary bindings for an initializer in a context that can allocate fresh names.

iarray :: forall len area. (IvoryArea area, ANat len) => [Init area] -> Init (Array len area) Source

newtype InitStruct sym Source

Constructors

InitStruct 

Fields

getInitStruct :: [(String, XInit)]
 

Instances

istruct :: forall sym. IvoryStruct sym => [InitStruct sym] -> Init (Struct sym) Source

(.=) :: Label sym area -> Init area -> InitStruct sym Source

local :: forall eff s area. (IvoryArea area, GetAlloc eff ~ Scope s) => Init area -> Ivory eff (Ref (Stack s) area) Source

Stack allocation