Safe Haskell | None |
---|
LLVM.DSL.Expression
- newtype Exp a = Exp {
- unExp :: forall r. CodeGenFunction r (T a)
- unique :: (forall r. CodeGenFunction r (T a)) -> Exp a
- _unique :: (forall r. CodeGenFunction r (T a)) -> Exp a
- withKey :: (forall r. CodeGenFunction r (T a)) -> IORef (Maybe (T a)) -> Exp a
- class Value val where
- lift3 :: Value val => (T a -> T b -> T c -> T d) -> val a -> val b -> val c -> val d
- lift4 :: Value val => (T a -> T b -> T c -> T d -> T e) -> val a -> val b -> val c -> val d -> val e
- liftM :: (forall r. T a -> CodeGenFunction r (T b)) -> Exp a -> Exp b
- liftM2 :: (forall r. T a -> T b -> CodeGenFunction r (T c)) -> Exp a -> Exp b -> Exp c
- liftM3 :: (forall r. T a -> T b -> T c -> CodeGenFunction r (T d)) -> Exp a -> Exp b -> Exp c -> Exp d
- unliftM1 :: (Exp a -> Exp b) -> T a -> CodeGenFunction r (T b)
- unliftM2 :: (Exp a -> Exp b -> Exp c) -> T a -> T b -> CodeGenFunction r (T c)
- unliftM3 :: (Exp a -> Exp b -> Exp c -> Exp d) -> T a -> T b -> T c -> CodeGenFunction r (T d)
- liftTupleM :: (forall r. ValueOf a -> CodeGenFunction r (ValueOf b)) -> Exp a -> Exp b
- liftTupleM2 :: (forall r. ValueOf a -> ValueOf b -> CodeGenFunction r (ValueOf c)) -> Exp a -> Exp b -> Exp c
- liftTupleM3 :: (forall r. ValueOf a -> ValueOf b -> ValueOf c -> CodeGenFunction r (ValueOf d)) -> Exp a -> Exp b -> Exp c -> Exp d
- zip :: Value val => val a -> val b -> val (a, b)
- zip3 :: Value val => val a -> val b -> val c -> val (a, b, c)
- zip4 :: Value val => val a -> val b -> val c -> val d -> val (a, b, c, d)
- unzip :: Value val => val (a, b) -> (val a, val b)
- unzip3 :: Value val => val (a, b, c) -> (val a, val b, val c)
- unzip4 :: Value val => val (a, b, c, d) -> (val a, val b, val c, val d)
- fst :: Value val => val (a, b) -> val a
- snd :: Value val => val (a, b) -> val b
- mapFst :: (Exp a -> Exp b) -> Exp (a, c) -> Exp (b, c)
- mapSnd :: (Exp b -> Exp c) -> Exp (a, b) -> Exp (a, c)
- mapPair :: (Exp a0 -> Exp a1, Exp b0 -> Exp b1) -> Exp (a0, b0) -> Exp (a1, b1)
- swap :: Value val => val (a, b) -> val (b, a)
- curry :: (Exp (a, b) -> c) -> Exp a -> Exp b -> c
- uncurry :: (Exp a -> Exp b -> c) -> Exp (a, b) -> c
- fst3 :: Value val => val (a, b, c) -> val a
- snd3 :: Value val => val (a, b, c) -> val b
- thd3 :: Value val => val (a, b, c) -> val c
- mapFst3 :: (Exp a0 -> Exp a1) -> Exp (a0, b, c) -> Exp (a1, b, c)
- mapSnd3 :: (Exp b0 -> Exp b1) -> Exp (a, b0, c) -> Exp (a, b1, c)
- mapThd3 :: (Exp c0 -> Exp c1) -> Exp (a, b, c0) -> Exp (a, b, c1)
- mapTriple :: (Exp a0 -> Exp a1, Exp b0 -> Exp b1, Exp c0 -> Exp c1) -> Exp (a0, b0, c0) -> Exp (a1, b1, c1)
- tuple :: Exp tuple -> Exp (Tuple tuple)
- untuple :: Exp (Tuple tuple) -> Exp tuple
- modifyMultiValue :: (Value val, Compose a, Decompose pattern, PatternTuple pattern ~ tuple) => pattern -> (Decomposed T pattern -> a) -> val tuple -> val (Composed a)
- modifyMultiValue2 :: (Value val, Compose a, Decompose patternA, Decompose patternB, PatternTuple patternA ~ tupleA, PatternTuple patternB ~ tupleB) => patternA -> patternB -> (Decomposed T patternA -> Decomposed T patternB -> a) -> val tupleA -> val tupleB -> val (Composed a)
- modifyMultiValueM :: (Compose a, Decompose pattern, PatternTuple pattern ~ tuple) => pattern -> (forall r. Decomposed T pattern -> CodeGenFunction r a) -> Exp tuple -> Exp (Composed a)
- modifyMultiValueM2 :: (Compose a, Decompose patternA, Decompose patternB, PatternTuple patternA ~ tupleA, PatternTuple patternB ~ tupleB) => patternA -> patternB -> (forall r. Decomposed T patternA -> Decomposed T patternB -> CodeGenFunction r a) -> Exp tupleA -> Exp tupleB -> Exp (Composed a)
- class Compose multituple where
- class Composed (Decomposed Exp pattern) ~ PatternTuple pattern => Decompose pattern where
- decompose :: pattern -> Exp (PatternTuple pattern) -> Decomposed Exp pattern
- modify :: (Compose a, Decompose pattern) => pattern -> (Decomposed Exp pattern -> a) -> Exp (PatternTuple pattern) -> Exp (Composed a)
- modify2 :: (Compose a, Decompose patternA, Decompose patternB) => patternA -> patternB -> (Decomposed Exp patternA -> Decomposed Exp patternB -> a) -> Exp (PatternTuple patternA) -> Exp (PatternTuple patternB) -> Exp (Composed a)
- consComplex :: Exp a -> Exp a -> Exp (Complex a)
- deconsComplex :: Exp (Complex a) -> (Exp a, Exp a)
- cons :: C a => a -> Exp a
- unit :: Exp ()
- zero :: C a => Exp a
- add :: Additive a => Exp a -> Exp a -> Exp a
- sub :: Additive a => Exp a -> Exp a -> Exp a
- neg :: Additive a => Exp a -> Exp a
- one :: IntegerConstant a => Exp a
- mul :: PseudoRing a => Exp a -> Exp a -> Exp a
- sqr :: PseudoRing a => Exp a -> Exp a
- recip :: (Field a, IntegerConstant a) => Exp a -> Exp a
- fdiv :: Field a => Exp a -> Exp a -> Exp a
- sqrt :: Algebraic a => Exp a -> Exp a
- pow :: Transcendental a => Exp a -> Exp a -> Exp a
- idiv :: Integral a => Exp a -> Exp a -> Exp a
- irem :: Integral a => Exp a -> Exp a -> Exp a
- shl :: BitShift a => Exp a -> Exp a -> Exp a
- shr :: BitShift a => Exp a -> Exp a -> Exp a
- fromInteger' :: IntegerConstant a => Integer -> Exp a
- fromRational' :: RationalConstant a => Rational -> Exp a
- boolPFrom8 :: Exp Bool8 -> Exp Bool
- bool8FromP :: Exp Bool -> Exp Bool8
- intFromBool8 :: NativeInteger i ir => Exp Bool8 -> Exp i
- floatFromBool8 :: NativeFloating a ar => Exp Bool8 -> Exp a
- toEnum :: ValueOf w ~ Value w => Exp w -> Exp (T w e)
- fromEnum :: ValueOf w ~ Value w => Exp (T w e) -> Exp w
- succ :: (IsArithmetic w, IntegerConstant w) => Exp (T w e) -> Exp (T w e)
- pred :: (IsArithmetic w, IntegerConstant w) => Exp (T w e) -> Exp (T w e)
- fromFastMath :: Exp (Number flags a) -> Exp a
- toFastMath :: Exp a -> Exp (Number flags a)
- minBound :: Bounded a => Exp a
- maxBound :: Bounded a => Exp a
- cmp :: Comparison a => CmpPredicate -> Exp a -> Exp a -> Exp Bool
- (==*) :: Comparison a => Exp a -> Exp a -> Exp Bool
- (<=*) :: Comparison a => Exp a -> Exp a -> Exp Bool
- (>*) :: Comparison a => Exp a -> Exp a -> Exp Bool
- (>=*) :: Comparison a => Exp a -> Exp a -> Exp Bool
- (<*) :: Comparison a => Exp a -> Exp a -> Exp Bool
- (/=*) :: Comparison a => Exp a -> Exp a -> Exp Bool
- min :: Real a => Exp a -> Exp a -> Exp a
- max :: Real a => Exp a -> Exp a -> Exp a
- limit :: Real a => (Exp a, Exp a) -> Exp a -> Exp a
- fraction :: Fraction a => Exp a -> Exp a
- true :: Exp Bool
- false :: Exp Bool
- (&&*) :: Exp Bool -> Exp Bool -> Exp Bool
- (||*) :: Exp Bool -> Exp Bool -> Exp Bool
- not :: Exp Bool -> Exp Bool
- select :: Select a => Exp Bool -> Exp a -> Exp a -> Exp a
- ifThenElse :: C a => Exp Bool -> Exp a -> Exp a -> Exp a
- complement :: Logic a => Exp a -> Exp a
- (.&.*) :: Logic a => Exp a -> Exp a -> Exp a
- (.|.*) :: Logic a => Exp a -> Exp a -> Exp a
- xor :: Logic a => Exp a -> Exp a -> Exp a
- toMaybe :: Exp Bool -> Exp a -> Exp (Maybe a)
- maybe :: C b => Exp b -> (Exp a -> Exp b) -> Exp (Maybe a) -> Exp b
- tau :: (Transcendental a, RationalConstant a) => Exp a
Documentation
Constructors
Exp | |
Fields
|
Instances
Value Exp | |
(Transcendental a, Real a, RationalConstant a) => Floating (Exp a) | |
(Field a, Real a, RationalConstant a) => Fractional (Exp a) | |
(PseudoRing a, Real a, IntegerConstant a) => Num (Exp a) | |
(Transcendental a, RationalConstant a) => C (Exp a) | |
(Transcendental a, RationalConstant a) => C (Exp a) | |
(Field a, RationalConstant a) => C (Exp a) | |
(Real a, PseudoRing a, IntegerConstant a) => C (Exp a) | |
(PseudoRing a, IntegerConstant a) => C (Exp a) | |
Additive a => C (Exp a) | We do not require a numeric prelude superclass, thus also LLVM only types like vectors are instances. |
Compose (Exp a) | |
(~ * a (Scalar v), PseudoModule v, IntegerConstant a) => C (Exp a) (Exp v) |
unique :: (forall r. CodeGenFunction r (T a)) -> Exp aSource
_unique :: (forall r. CodeGenFunction r (T a)) -> Exp aSource
lift4 :: Value val => (T a -> T b -> T c -> T d -> T e) -> val a -> val b -> val c -> val d -> val eSource
liftM3 :: (forall r. T a -> T b -> T c -> CodeGenFunction r (T d)) -> Exp a -> Exp b -> Exp c -> Exp dSource
unliftM3 :: (Exp a -> Exp b -> Exp c -> Exp d) -> T a -> T b -> T c -> CodeGenFunction r (T d)Source
liftTupleM :: (forall r. ValueOf a -> CodeGenFunction r (ValueOf b)) -> Exp a -> Exp bSource
liftTupleM2 :: (forall r. ValueOf a -> ValueOf b -> CodeGenFunction r (ValueOf c)) -> Exp a -> Exp b -> Exp cSource
liftTupleM3 :: (forall r. ValueOf a -> ValueOf b -> ValueOf c -> CodeGenFunction r (ValueOf d)) -> Exp a -> Exp b -> Exp c -> Exp dSource
mapTriple :: (Exp a0 -> Exp a1, Exp b0 -> Exp b1, Exp c0 -> Exp c1) -> Exp (a0, b0, c0) -> Exp (a1, b1, c1)Source
modifyMultiValue :: (Value val, Compose a, Decompose pattern, PatternTuple pattern ~ tuple) => pattern -> (Decomposed T pattern -> a) -> val tuple -> val (Composed a)Source
modifyMultiValue2 :: (Value val, Compose a, Decompose patternA, Decompose patternB, PatternTuple patternA ~ tupleA, PatternTuple patternB ~ tupleB) => patternA -> patternB -> (Decomposed T patternA -> Decomposed T patternB -> a) -> val tupleA -> val tupleB -> val (Composed a)Source
modifyMultiValueM :: (Compose a, Decompose pattern, PatternTuple pattern ~ tuple) => pattern -> (forall r. Decomposed T pattern -> CodeGenFunction r a) -> Exp tuple -> Exp (Composed a)Source
modifyMultiValueM2 :: (Compose a, Decompose patternA, Decompose patternB, PatternTuple patternA ~ tupleA, PatternTuple patternB ~ tupleB) => patternA -> patternB -> (forall r. Decomposed T patternA -> Decomposed T patternB -> CodeGenFunction r a) -> Exp tupleA -> Exp tupleB -> Exp (Composed a)Source
class Composed (Decomposed Exp pattern) ~ PatternTuple pattern => Decompose pattern whereSource
Methods
decompose :: pattern -> Exp (PatternTuple pattern) -> Decomposed Exp patternSource
Analogous to decompose
.
Instances
Decompose () | |
Decompose p => Decompose (Complex p) | |
Decompose (Atom a) | |
Decompose p => Decompose (Tuple p) | |
(Decompose pa, Decompose pb) => Decompose (pa, pb) | |
(Decompose pa, Decompose pb, Decompose pc) => Decompose (pa, pb, pc) | |
(Decompose pa, Decompose pb, Decompose pc, Decompose pd) => Decompose (pa, pb, pc, pd) |
modify :: (Compose a, Decompose pattern) => pattern -> (Decomposed Exp pattern -> a) -> Exp (PatternTuple pattern) -> Exp (Composed a)Source
Analogus to modifyMultiValue
.
modify2 :: (Compose a, Decompose patternA, Decompose patternB) => patternA -> patternB -> (Decomposed Exp patternA -> Decomposed Exp patternB -> a) -> Exp (PatternTuple patternA) -> Exp (PatternTuple patternB) -> Exp (Composed a)Source
consComplex :: Exp a -> Exp a -> Exp (Complex a)Source
You can construct complex numbers this way, but they will not make you happy, because the numeric operations require a RealFloat instance that we could only provide with lots of undefined methods (also in its superclasses). You may either define your own arithmetic or use the NumericPrelude type classes.
one :: IntegerConstant a => Exp aSource
sqr :: PseudoRing a => Exp a -> Exp aSource
fromInteger' :: IntegerConstant a => Integer -> Exp aSource
fromRational' :: RationalConstant a => Rational -> Exp aSource
intFromBool8 :: NativeInteger i ir => Exp Bool8 -> Exp iSource
floatFromBool8 :: NativeFloating a ar => Exp Bool8 -> Exp aSource
fromFastMath :: Exp (Number flags a) -> Exp aSource
toFastMath :: Exp a -> Exp (Number flags a)Source
cmp :: Comparison a => CmpPredicate -> Exp a -> Exp a -> Exp BoolSource
select :: Select a => Exp Bool -> Exp a -> Exp a -> Exp aSource
Like ifThenElse
but computes both alternative expressions
and then uses LLVM's efficient select
instruction.
complement :: Logic a => Exp a -> Exp aSource
tau :: (Transcendental a, RationalConstant a) => Exp aSource