ivory-0.1.0.7: 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

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.

Minimal complete definition

izero

Methods

izero :: Init area Source #

Instances

IvoryStruct sym => IvoryZero (Struct * sym) Source # 

Methods

izero :: Init (Struct * sym) Source #

IvoryZeroVal a => IvoryZero (Stored * a) Source # 

Methods

izero :: Init (Stored * a) Source #

(IvoryZero area, IvoryArea area, ANat len) => IvoryZero (Array * len area) Source # 

Methods

izero :: Init (Array * len area) Source #

refZero :: forall eff s a. (IvoryZero a, IvoryArea a) => Ref s a -> Ivory eff () Source #

Zero the memory pointed to by this reference, as long as it could have been created with a zero initializer.

class Monad m => FreshName m where Source #

Minimal complete definition

freshName

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.

class IvoryVar e => IvoryInit e where Source #

Initializers for Stored things.

Methods

ival :: e -> Init (Stored e) Source #

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

newtype InitStruct sym Source #

Constructors

InitStruct 

Fields

Instances

IvoryStruct sym => Monoid (InitStruct sym) Source # 

Methods

mempty :: InitStruct sym #

mappend :: InitStruct sym -> InitStruct sym -> InitStruct sym #

mconcat :: [InitStruct sym] -> InitStruct sym #

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