Safe Haskell | None |
---|
- Kinds
- Types
- Effects
- Language
- Monadic Interface
- Subexpression naming
- Constants
- Arithmetic (operators from the
Num
class are also provided). - Comparisons
- Boolean operators
- Bit operators
- External memory areas
- Procedures
- Assumption/Assertion statements
- Structures
- Arrays
- Strings
- Looping
- Call
- Conditional Branching
- Return
- Type-safe casting.
- Module Definitions
- Utilities
- data Area k
- data Proc k = [k] :-> k
- class IvoryType t
- class IvoryArea a
- class IvoryType t => IvoryVar t
- class IvoryVar t => IvoryExpr t
- data OpaqueType
- class IvoryRef ref
- data ConstRef s a
- class IvoryVar a => IvoryStore a
- data Ref s a
- refToPtr :: IvoryArea area => Ref s area -> Ptr s area
- constRef :: IvoryArea area => Ref s area -> ConstRef s area
- deref :: forall eff ref s a. (IvoryVar a, IvoryVar (ref s (Stored a)), IvoryRef ref) => ref s (Stored a) -> Ivory eff a
- store :: forall eff s a. IvoryStore a => Ref s (Stored a) -> a -> Ivory eff ()
- refCopy :: forall eff sTo ref sFrom a. (IvoryRef ref, IvoryVar (Ref sTo a), IvoryVar (ref sFrom a), IvoryArea a) => Ref sTo a -> ref sFrom a -> Ivory eff ()
- class IvoryVar e => IvoryInit e where
- data Init area
- class IvoryZero area where
- iarray :: forall len area. (IvoryArea area, SingI len) => [Init area] -> Init (Array len area)
- data InitStruct sym
- (.=) :: Label sym area -> Init area -> InitStruct sym
- istruct :: forall sym. IvoryStruct sym => [InitStruct sym] -> Init (Struct sym)
- local :: forall eff s area. (IvoryArea area, GetAlloc eff ~ Scope s) => Init area -> Ivory eff (Ref (Stack s) area)
- class IvoryArea t => IvorySizeOf t where
- sizeOfBytes :: Proxy t -> Integer
- sizeOf :: (IvorySizeOf t, IvoryExpr a, Num a) => Proxy t -> a
- data Ptr s a
- nullPtr :: IvoryArea area => Ptr s area
- data IBool
- true :: IBool
- false :: IBool
- data IChar
- char :: Char -> IChar
- data IString
- data Sint8
- data Sint16
- data Sint32
- data Sint64
- data Uint8
- data Uint16
- data Uint32
- data Uint64
- data IFloat
- data IDouble
- isnan :: forall a. (IvoryVar a, Floating a) => a -> IBool
- isinf :: forall a. (IvoryVar a, Floating a) => a -> IBool
- roundF :: IvoryFloat a => a -> a
- ceilF :: IvoryFloat a => a -> a
- floorF :: IvoryFloat a => a -> a
- ifloat :: Float -> IFloat
- idouble :: Double -> IDouble
- data Effects = Effects ReturnEff BreakEff AllocEff
- data BreakEff
- type family GetBreaks effs :: BreakEff
- type family AllowBreak effs :: Effects
- type family ClearBreak effs :: Effects
- noBreak :: Ivory (ClearBreak eff) a -> Ivory eff a
- data ReturnEff
- type family GetReturn effs :: ReturnEff
- type family ClearReturn effs :: Effects
- noReturn :: Ivory (ClearReturn eff) a -> Ivory eff a
- data AllocEff
- type family GetAlloc effs :: AllocEff
- type family ClearAlloc effs :: Effects
- noAlloc :: innerEff ~ ClearAlloc outerEff => Ivory innerEff a -> Ivory outerEff a
- type AllocEffects s = Effects NoReturn NoBreak (Scope s)
- type ProcEffects s t = Effects (Returns t) NoBreak (Scope s)
- type NoEffects = Effects NoReturn NoBreak NoAlloc
- data Ivory eff a
- data RefScope
- assign :: forall eff a. IvoryExpr a => a -> Ivory eff a
- extern :: IvoryExpr t => Sym -> t
- class (IvoryExpr a, Num a) => IvoryIntegral a where
- class IvoryExpr a => IvoryEq a where
- class IvoryEq a => IvoryOrd a where
- iNot :: IBool -> IBool
- (.&&) :: IBool -> IBool -> IBool
- (.||) :: IBool -> IBool -> IBool
- class (Num a, IvoryExpr a) => IvoryBits a where
- extractByte :: BitCast a Uint8 => a -> (Uint8, a)
- class (IvoryBits a, IvoryBits b) => BitSplit a b | a -> b where
- class (IvoryBits a, IvoryBits b) => BitCast a b where
- bitCast :: a -> b
- data MemArea area
- area :: forall area. IvoryArea area => Sym -> Maybe (Init area) -> MemArea area
- importArea :: IvoryArea area => Sym -> String -> MemArea area
- data ConstMemArea area
- constArea :: forall area. IvoryArea area => Sym -> Init area -> ConstMemArea area
- importConstArea :: IvoryArea area => Sym -> String -> ConstMemArea area
- class IvoryAddrOf mem ref | mem -> ref, ref -> mem where
- data Def proc
- data ProcPtr sig
- procPtr :: ProcType sig => Def sig -> ProcPtr sig
- proc :: forall proc impl. IvoryProcDef proc impl => Sym -> impl -> Def proc
- externProc :: forall proc. ProcType proc => Sym -> Def proc
- importProc :: forall proc. ProcType proc => Sym -> String -> Def proc
- data Body r
- body :: IvoryType r => (forall s. Ivory (ProcEffects s r) ()) -> Body r
- requires :: (Requires c, IvoryType r) => c -> Body r -> Body r
- checkStored :: forall ref s a. (IvoryVar a, IvoryRef ref, IvoryVar (ref s (Stored a))) => ref s (Stored a) -> (a -> IBool) -> Cond
- ensures :: (Ensures c, IvoryVar r) => (r -> c) -> Body r -> Body r
- assert :: forall a eff. IvoryExpr a => a -> Ivory eff ()
- assume :: forall a eff. IvoryExpr a => a -> Ivory eff ()
- class (IvoryArea (Struct sym), SingI sym) => IvoryStruct sym where
- type StructName a :: Symbol
- structDef :: StructDef sym
- data StructDef sym
- ivory :: QuasiQuoter
- (~>) :: forall ref s sym field. (IvoryStruct sym, IvoryRef ref, IvoryExpr (ref s (Struct sym)), IvoryExpr (ref s field)) => ref s (Struct sym) -> Label sym field -> ref s field
- data Label sym field
- (!) :: forall s len area ref. (SingI len, IvoryArea area, IvoryRef ref, IvoryExpr (ref s (Array len area)), IvoryExpr (ref s area)) => ref s (Array len area) -> Ix len -> ref s area
- fromIx :: SingI n => Ix n -> IxRep
- toIx :: (IvoryExpr a, Bounded a, SingI n) => a -> Ix n
- data Ix n
- ixSize :: forall n. SingI n => Ix n -> Integer
- arrayLen :: forall s len area n ref. (Num n, SingI len, IvoryArea area, IvoryRef ref) => ref s (Array len area) -> n
- class SingI a
- toCArray :: forall s len area rep ref. (SingI len, ToCArray area rep, IvoryRef ref, IvoryExpr (ref s (Array len area)), IvoryExpr (ref s (CArray rep))) => ref s (Array len area) -> ref s (CArray rep)
- class (SingI (Capacity a), IvoryStruct (StructName a), IvoryArea a, a ~ Struct (StructName a)) => IvoryString a where
- type Capacity a :: Nat
- stringDataL :: Label (StructName a) (Array (Capacity a) (Stored Uint8))
- stringLengthL :: Label (StructName a) (Stored (Ix (Capacity a)))
- for :: forall eff n a. SingI n => Ix n -> (Ix n -> Ivory (AllowBreak eff) a) -> Ivory eff ()
- times :: forall eff n a. SingI n => Ix n -> (Ix n -> Ivory (AllowBreak eff) a) -> Ivory eff ()
- breakOut :: GetBreaks eff ~ Break => Ivory eff ()
- arrayMap :: forall eff n a. SingI n => (Ix n -> Ivory (AllowBreak eff) a) -> Ivory eff ()
- forever :: Ivory (AllowBreak eff) () -> Ivory eff ()
- call :: forall proc eff impl. IvoryCall proc eff impl => Def proc -> impl
- indirect :: forall proc eff impl. IvoryCall proc eff impl => ProcPtr proc -> impl
- call_ :: forall proc eff impl. IvoryCall_ proc eff impl => Def proc -> impl
- indirect_ :: forall proc eff impl. IvoryCall_ proc eff impl => ProcPtr proc -> impl
- ifte_ :: IBool -> Ivory eff a -> Ivory eff b -> Ivory eff ()
- (?) :: forall a. IvoryExpr a => IBool -> (a, a) -> a
- withRef :: IvoryArea area => Ptr as area -> (Ref as area -> Ivory eff t) -> Ivory eff f -> Ivory eff ()
- ret :: (GetReturn eff ~ Returns r, IvoryVar r) => r -> Ivory eff ()
- retVoid :: GetReturn eff ~ Returns () => Ivory eff ()
- class (IvoryExpr from, IvoryExpr to) => SafeCast from to where
- safeCast :: from -> to
- class (IvoryExpr from, IvoryExpr to, Default to) => RuntimeCast from to
- class Default a
- castWith :: RuntimeCast from to => to -> from -> to
- castDefault :: (Default to, RuntimeCast from to) => from -> to
- class (IvoryExpr from, IvoryExpr to) => SignCast from to where
- signCast :: from -> to
- data Module
- moduleName :: Module -> String
- package :: String -> ModuleDef -> Module
- type ModuleDef = ModuleM ()
- incl :: Def a -> ModuleDef
- depend :: Module -> ModuleDef
- defStruct :: forall sym. (IvoryStruct sym, SingI sym) => Proxy sym -> ModuleDef
- defStringType :: forall str. IvoryString str => Proxy str -> ModuleDef
- defMemArea :: IvoryArea area => MemArea area -> ModuleDef
- defConstMemArea :: IvoryArea area => ConstMemArea area -> ModuleDef
- inclHeader :: String -> ModuleDef
- private :: ModuleDef -> ModuleDef
- public :: ModuleDef -> ModuleDef
- sourceDep :: FilePath -> ModuleDef
- data Proxy a = Proxy
Kinds
The kind of memory-area types.
Types
The connection between haskell and ivory types.
IvoryType () | |
IvoryType OpaqueType | |
IvoryType IString | |
IvoryType IChar | |
IvoryType Sint64 | |
IvoryType Sint32 | |
IvoryType Sint16 | |
IvoryType Sint8 | |
IvoryType Uint64 | |
IvoryType Uint32 | |
IvoryType Uint16 | |
IvoryType Uint8 | |
IvoryType IBool | |
IvoryType IDouble | |
IvoryType IFloat | |
ProcType proc => IvoryType (Def proc) | |
ProcType proc => IvoryType (ProcPtr proc) | |
SingI Nat n => IvoryType (Ix n) | |
IvoryArea area => IvoryType (ConstRef s area) | |
IvoryArea area => IvoryType (Ref s area) | |
IvoryArea area => IvoryType (Ptr s area) |
Guard the inhabitants of the Area type, as not all *s are Ivory *s.
class IvoryType t => IvoryVar t Source
Lifting a variable name.
IvoryVar IString | |
IvoryVar IChar | |
IvoryVar Sint64 | |
IvoryVar Sint32 | |
IvoryVar Sint16 | |
IvoryVar Sint8 | |
IvoryVar Uint64 | |
IvoryVar Uint32 | |
IvoryVar Uint16 | |
IvoryVar Uint8 | |
IvoryVar IBool | |
IvoryVar IDouble | |
IvoryVar IFloat | |
ProcType proc => IvoryVar (ProcPtr proc) | |
SingI Nat n => IvoryVar (Ix n) | |
IvoryArea area => IvoryVar (ConstRef s area) | |
IvoryArea area => IvoryVar (Ref s area) | |
IvoryArea area => IvoryVar (Ptr s area) |
class IvoryVar t => IvoryExpr t Source
Unwrapping for ivory expressions.
IvoryExpr IString | |
IvoryExpr IChar | |
IvoryExpr Sint64 | |
IvoryExpr Sint32 | |
IvoryExpr Sint16 | |
IvoryExpr Sint8 | |
IvoryExpr Uint64 | |
IvoryExpr Uint32 | |
IvoryExpr Uint16 | |
IvoryExpr Uint8 | |
IvoryExpr IBool | |
IvoryExpr IDouble | |
IvoryExpr IFloat | |
SingI Nat n => IvoryExpr (Ix n) | |
IvoryArea area => IvoryExpr (ConstRef s area) | |
IvoryArea area => IvoryExpr (Ref s area) | |
IvoryArea area => IvoryExpr (Ptr s area) |
Non-null References
class IvoryVar a => IvoryStore a Source
Things that can be safely stored in references.
A non-null pointer to a memory area.
refToPtr :: IvoryArea area => Ref s area -> Ptr s areaSource
Convert a reference to a pointer. This direction is safe as we know that the reference is a non-null pointer.
constRef :: IvoryArea area => Ref s area -> ConstRef s areaSource
Turn a reference into a constant reference.
deref :: forall eff ref s a. (IvoryVar a, IvoryVar (ref s (Stored a)), IvoryRef ref) => ref s (Stored a) -> Ivory eff aSource
Dereferenceing.
refCopy :: forall eff sTo ref sFrom a. (IvoryRef ref, IvoryVar (Ref sTo a), IvoryVar (ref sFrom a), IvoryArea a) => Ref sTo a -> ref sFrom a -> Ivory eff ()Source
Memory copy. Emits an assertion that the two references are unequal.
Stack Allocation
class IvoryVar e => IvoryInit e whereSource
Initializers for Stored
things.
IvoryInit IChar | |
IvoryInit Sint64 | |
IvoryInit Sint32 | |
IvoryInit Sint16 | |
IvoryInit Sint8 | |
IvoryInit Uint64 | |
IvoryInit Uint32 | |
IvoryInit Uint16 | |
IvoryInit Uint8 | |
IvoryInit IBool | |
IvoryInit IDouble | |
IvoryInit IFloat | |
ProcType proc => IvoryInit (ProcPtr proc) | |
SingI Nat len => IvoryInit (Ix len) | |
IvoryArea area => IvoryInit (Ptr Global area) |
iarray :: forall len area. (IvoryArea area, SingI len) => [Init area] -> Init (Array len area)Source
data InitStruct sym Source
IvoryStruct sym => Monoid (InitStruct sym) |
(.=) :: Label sym area -> Init area -> InitStruct symSource
istruct :: forall sym. IvoryStruct sym => [InitStruct sym] -> Init (Struct sym)Source
local :: forall eff s area. (IvoryArea area, GetAlloc eff ~ Scope s) => Init area -> Ivory eff (Ref (Stack s) area)Source
Stack allocation
SizeOf
class IvoryArea t => IvorySizeOf t whereSource
sizeOfBytes :: Proxy t -> IntegerSource
IvorySizeOf (Stored * IChar) | |
IvorySizeOf (Stored * Sint64) | |
IvorySizeOf (Stored * Sint32) | |
IvorySizeOf (Stored * Sint16) | |
IvorySizeOf (Stored * Sint8) | |
IvorySizeOf (Stored * Uint64) | |
IvorySizeOf (Stored * Uint32) | |
IvorySizeOf (Stored * Uint16) | |
IvorySizeOf (Stored * Uint8) | |
IvorySizeOf (Stored * IDouble) | |
IvorySizeOf (Stored * IFloat) | |
(SingI Nat len, IvorySizeOf area) => IvorySizeOf (Array * len area) |
Nullable Pointers
Pointers (nullable references).
IvoryArea area => IvoryExpr (Ptr s area) | |
IvoryArea area => IvoryVar (Ptr s area) | |
IvoryArea area => IvoryType (Ptr s area) | |
IvoryArea area => IvoryEq (Ptr s area) | |
IvoryArea a => IvoryStore (Ptr Global a) | |
IvoryArea area => IvoryInit (Ptr Global area) | |
IvoryArea area => IvoryZero (Stored * (Ptr Global area)) |
Booleans
Characters
Strings
Signed Integers
8-bit integers.
16-bit integers.
32-bit integers.
64-bit integers.
Unsigned Integers
8-bit words.
16-bit words.
32-bit words.
64-bit words.
Floating-point Numbers
Floating IFloat | |
Fractional IFloat | |
Num IFloat | |
IvoryExpr IFloat | |
IvoryVar IFloat | |
IvoryType IFloat | |
IvoryOrd IFloat | |
IvoryEq IFloat | |
IvoryStore IFloat | |
IvoryFloat IFloat | |
Default IFloat | |
IvoryInit IFloat | |
(Default to, Bounded to, IvoryIntegral to, SafeCast to IFloat) => RuntimeCast IFloat to | Casting from a floating to a |
SafeCast Sint32 IFloat | |
SafeCast Sint16 IFloat | |
SafeCast Sint8 IFloat | |
SafeCast Uint32 IFloat | |
SafeCast Uint16 IFloat | |
SafeCast Uint8 IFloat | |
SafeCast IBool IFloat | |
SafeCast IFloat IDouble | |
SafeCast IFloat IFloat | |
IvorySizeOf (Stored * IFloat) |
roundF :: IvoryFloat a => a -> aSource
Round a floating point number.
ceilF :: IvoryFloat a => a -> aSource
Take the ceiling of a floating point number.
floorF :: IvoryFloat a => a -> aSource
Take the floor of a floating point number.
Effects
type family AllowBreak effs :: EffectsSource
Add the Break
effect into an effect context.
type family ClearBreak effs :: EffectsSource
Remove any Break
effect present.
noBreak :: Ivory (ClearBreak eff) a -> Ivory eff aSource
type family ClearReturn effs :: EffectsSource
Remove any Return
effects present.
noReturn :: Ivory (ClearReturn eff) a -> Ivory eff aSource
type family ClearAlloc effs :: EffectsSource
Remove any allocation effect currently present.
noAlloc :: innerEff ~ ClearAlloc outerEff => Ivory innerEff a -> Ivory outerEff aSource
Language
Monadic Interface
Definition scopes for values.
Subexpression naming
Constants
extern :: IvoryExpr t => Sym -> tSource
Import and externally defined constant by providing a global name.
Arithmetic (operators from the Num
class are also provided).
class (IvoryExpr a, Num a) => IvoryIntegral a whereSource
Comparisons
Boolean operators
Bit operators
extractByte :: BitCast a Uint8 => a -> (Uint8, a)Source
Extract the least significant byte from an integer. This returns the two values (x & 0xFF, x >> 8), with the first value safely casted to an 8-bit integer.
This is convenient to use with a state monad and sets, such as:
fst $ runState x $ do a <- sets extractByte b <- sets extractByte return (a, b)
class (IvoryBits a, IvoryBits b) => BitSplit a b | a -> b whereSource
Extraction of the upper or lower half of a bit type into the next smallest bit type.
class (IvoryBits a, IvoryBits b) => BitCast a b whereSource
A narrowing cast from one bit type to another. This explicitly discards the upper bits of the input value to return a smaller type, and is only defined for unsigned integers.
External memory areas
area :: forall area. IvoryArea area => Sym -> Maybe (Init area) -> MemArea areaSource
Define a global constant.
importArea :: IvoryArea area => Sym -> String -> MemArea areaSource
Import an external symbol from a header.
data ConstMemArea area Source
constArea :: forall area. IvoryArea area => Sym -> Init area -> ConstMemArea areaSource
Constant memory area definition.
importConstArea :: IvoryArea area => Sym -> String -> ConstMemArea areaSource
Import an external symbol from a header.
class IvoryAddrOf mem ref | mem -> ref, ref -> mem whereSource
Turn a memory area into a reference.
Procedures
Procedure definitions.
Procedure pointers
proc :: forall proc impl. IvoryProcDef proc impl => Sym -> impl -> Def procSource
Procedure definition.
externProc :: forall proc. ProcType proc => Sym -> Def procSource
External function reference.
importProc :: forall proc. ProcType proc => Sym -> String -> Def procSource
Import a function from a C header.
Pre/Post-Conditions
checkStored :: forall ref s a. (IvoryVar a, IvoryRef ref, IvoryVar (ref s (Stored a))) => ref s (Stored a) -> (a -> IBool) -> CondSource
Assumption/Assertion statements
Structures
class (IvoryArea (Struct sym), SingI sym) => IvoryStruct sym whereSource
type StructName a :: SymbolSource
(~>) :: forall ref s sym field. (IvoryStruct sym, IvoryRef ref, IvoryExpr (ref s (Struct sym)), IvoryExpr (ref s field)) => ref s (Struct sym) -> Label sym field -> ref s fieldSource
Label indexing in a structure.
Arrays
(!) :: forall s len area ref. (SingI len, IvoryArea area, IvoryRef ref, IvoryExpr (ref s (Array len area)), IvoryExpr (ref s area)) => ref s (Array len area) -> Ix len -> ref s areaSource
Array indexing.
toIx :: (IvoryExpr a, Bounded a, SingI n) => a -> Ix nSource
Casting from a bounded Ivory expression to an index. This is safe, although the value may be truncated. Furthermore, indexes are always positive.
Values in the range 0 .. n-1
.
SingI Nat n => Num (Ix n) | |
SingI Nat n => IvoryExpr (Ix n) | |
SingI Nat n => IvoryVar (Ix n) | |
SingI Nat n => IvoryType (Ix n) | |
SingI Nat n => IvoryOrd (Ix n) | |
SingI Nat n => IvoryEq (Ix n) | |
SingI Nat n => IvoryStore (Ix n) | |
SingI Nat len => IvoryInit (Ix len) | |
(SingI Nat n, IvoryIntegral to, Default to) => SafeCast (Ix n) to |
arrayLen :: forall s len area n ref. (Num n, SingI len, IvoryArea area, IvoryRef ref) => ref s (Array len area) -> nSource
class SingI a
The class SingI
provides a "smart" constructor for singleton types.
There are built-in instances for the singleton types corresponding
to type literals.
toCArray :: forall s len area rep ref. (SingI len, ToCArray area rep, IvoryRef ref, IvoryExpr (ref s (Array len area)), IvoryExpr (ref s (CArray rep))) => ref s (Array len area) -> ref s (CArray rep)Source
Convert from a checked array to one that can be given to a c function.
Strings
class (SingI (Capacity a), IvoryStruct (StructName a), IvoryArea a, a ~ Struct (StructName a)) => IvoryString a whereSource
stringDataL :: Label (StructName a) (Array (Capacity a) (Stored Uint8))Source
stringLengthL :: Label (StructName a) (Stored (Ix (Capacity a)))Source
Looping
for :: forall eff n a. SingI n => Ix n -> (Ix n -> Ivory (AllowBreak eff) a) -> Ivory eff ()Source
Run the computation n times, where for
n :: Ix m, 0 <= n < m.
Indexes increment from 0 to n-1.
times :: forall eff n a. SingI n => Ix n -> (Ix n -> Ivory (AllowBreak eff) a) -> Ivory eff ()Source
Run the computation n times, where for
n :: Ix m, 0 <= n < m.
Indexes decrement from n-1 to 0.
forever :: Ivory (AllowBreak eff) () -> Ivory eff ()Source
Call
indirect :: forall proc eff impl. IvoryCall proc eff impl => ProcPtr proc -> implSource
Indirect calls.
call_ :: forall proc eff impl. IvoryCall_ proc eff impl => Def proc -> implSource
Direct calls, ignoring the result.
indirect_ :: forall proc eff impl. IvoryCall_ proc eff impl => ProcPtr proc -> implSource
Indirect calls, ignoring the result.
Conditional Branching
withRef :: IvoryArea area => Ptr as area -> (Ref as area -> Ivory eff t) -> Ivory eff f -> Ivory eff ()Source
Unwrap a pointer, and use it as a reference.
Return
ret :: (GetReturn eff ~ Returns r, IvoryVar r) => r -> Ivory eff ()Source
Primitive return from function.
Type-safe casting.
class (IvoryExpr from, IvoryExpr to) => SafeCast from to whereSource
Statically safe casts.
class (IvoryExpr from, IvoryExpr to, Default to) => RuntimeCast from to Source
Casts requiring runtime checks.
(Bounded from, Bounded to, IvoryOrd from, IvoryOrd to, IvoryExpr from, IvoryExpr to, Default from, Default to, SafeCast to from) => RuntimeCast from to | |
(Default to, Bounded to, IvoryIntegral to, SafeCast to IDouble) => RuntimeCast IDouble to | |
(Default to, Bounded to, IvoryIntegral to, SafeCast to IFloat) => RuntimeCast IFloat to | Casting from a floating to a |
Default values for expression types.
castWith :: RuntimeCast from to => to -> from -> toSource
Cast with a default value if the casted value is too large.
castDefault :: (Default to, RuntimeCast from to) => from -> toSource
`CastWith 0` for types for which 0 is defined.
class (IvoryExpr from, IvoryExpr to) => SignCast from to whereSource
SignCast takes a unsigned number into its signed form iff safe, otherwise 0, and same with signed into unsigned
Module Definitions
moduleName :: Module -> StringSource
defStruct :: forall sym. (IvoryStruct sym, SingI sym) => Proxy sym -> ModuleDefSource
Include the definition of a structure in the module.
defStringType :: forall str. IvoryString str => Proxy str -> ModuleDefSource
Include the definition of a string type's structure.
defMemArea :: IvoryArea area => MemArea area -> ModuleDefSource
Include the definition of a memory area.
defConstMemArea :: IvoryArea area => ConstMemArea area -> ModuleDefSource
Include the definition of a constant memory area.
inclHeader :: String -> ModuleDefSource
Add a dependency on an external header.
private :: ModuleDef -> ModuleDefSource
Start a block of definitions that should not be put in the header.
public :: ModuleDef -> ModuleDefSource
Start a block of definitions should be put in the header. This is the
default, and this function is just included to complement private
.
sourceDep :: FilePath -> ModuleDefSource
Depend on an existing (object language) source file which should be copied to the user build tree as part of code generation