ivory-0.1.0.0: Safe embedded C programming.

Safe HaskellNone

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 -> TypeSource

Return the type of the initializer.

newtype Init area Source

Constructors

Init 

Fields

getInit :: XInit
 

class IvoryZero area whereSource

Zero initializers.

Methods

izero :: Init areaSource

Instances

(Num a, IvoryInit a) => IvoryZero (Stored * a) 
IvoryZero (Stored * IChar) 
IvoryZero (Stored * IBool) 
IvoryArea area => IvoryZero (Stored * (Ptr Global area)) 
IvoryStruct sym => IvoryZero (Struct * sym) 
(IvoryZero area, IvoryArea area, SingI Nat len) => IvoryZero (Array * len area) 

class Monad m => FreshName m whereSource

Methods

freshName :: String -> m VarSource

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, SingI 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 symSource

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

Stack allocation