llvm-extra-0.6.0.1: Utility functions for the llvm interface

Safe HaskellNone
LanguageHaskell98

LLVM.Extra.Maybe

Description

LLVM counterpart to Maybe datatype.

Synopsis

Documentation

data T a Source

If isJust = False, then fromJust is an undefTuple.

Constructors

Cons 

Fields

isJust :: Value Bool
 
fromJust :: a
 

Instances

Functor T 
Phi a => Phi (T a) 
Undefined a => Undefined (T a) 
C a => C (T a) 
type Struct (T a) = Struct (Word32, (Struct a, ())) 

run :: Phi b => T a -> CodeGenFunction r b -> (a -> CodeGenFunction r b) -> CodeGenFunction r b Source

counterpart to maybe

for :: T a -> (a -> CodeGenFunction r ()) -> CodeGenFunction r () Source

select :: Select a => T a -> a -> CodeGenFunction r a Source

counterpart to fromMaybe with swapped arguments

alternative :: Select a => T a -> T a -> CodeGenFunction r (T a) Source

fromBool :: Value Bool -> a -> T a Source

counterpart to Data.Maybe.HT.toMaybe

toBool :: T a -> (Value Bool, a) Source

just :: a -> T a Source

traverse :: (a -> CodeGenFunction r b) -> T a -> CodeGenFunction r (T b) Source

lift2 :: (a -> b -> c) -> T a -> T b -> CodeGenFunction r (T c) Source

liftM2 :: (a -> b -> CodeGenFunction r c) -> T a -> T b -> CodeGenFunction r (T c) Source

loopWithExit :: Phi a => a -> (a -> CodeGenFunction r (T c, b)) -> ((c, b) -> CodeGenFunction r a) -> CodeGenFunction r b Source