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

Safe HaskellNone

LLVM.Extra.Either

Description

LLVM counterpart to Either datatype.

Synopsis

Documentation

data T a b Source

If isRight, then fromLeft is an undefTuple. If not isRight, then fromRight is an undefTuple. I would prefer a union type, but it was temporarily removed in LLVM-2.8 and did not return since then.

Constructors

Cons 

Fields

isRight :: Value Bool
 
fromLeft :: a
 
fromRight :: b
 

Instances

(Phi a, Phi b) => Phi (T a b) 
(Undefined a, Undefined b) => Undefined (T a b) 
(C a, C b) => C (T a b) 

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

counterpart to either

getIsLeft :: T a b -> CodeGenFunction r (Value Bool)Source

mapLeft :: (a0 -> a1) -> T a0 b -> T a1 bSource

mapRight :: (b0 -> b1) -> T a b0 -> T a b1Source

left :: Undefined b => a -> T a bSource

right :: Undefined a => b -> T a bSource