knead-0.5: Repa-like array processing using LLVM JIT

Safe HaskellNone

Data.Array.Knead.Parameter

Synopsis

Documentation

data T p a

This data type is for parameters of parameterized LLVM code. It is better than using plain functions of type p -> a since it allows for numeric instances and we can make explicit, whether a parameter is constant.

We recommend to use parameters for atomic types. Although a parameter of type T p (a,b) is possible, it means that the whole parameter is variable if only one of the pair elements is variable. This way you may miss opportunities for constant folding.

Instances

Arrow T

arr is useful for lifting parameter selectors to our parameter type without relying on the constructor.

Category T

. can be used for fetching a parameter from a super-parameter.

Monad (T p) 
Functor (T p)

Useful for splitting T p (a,b) into T p a and T p b using fmap fst and fmap snd.

Applicative (T p)

Useful for combining T p a and T p b to T p (a,b) using liftA2 (,). However, we do not recommend to do so because the result parameter can only be constant if both operands are constant.

Floating a => Floating (T p a) 
Fractional a => Fractional (T p a) 
Num a => Num (T p a) 
Tuple (T p a) 
C a => C (T p a) 
C a => C (T p a) 
C a => C (T p a) 
C a => C (T p a) 
C a => C (T p a)