patch-image-llvm

Safe HaskellNone
LanguageHaskell98

KneadShape

Synopsis

Documentation

type Size = Int64 Source

I choose a bit complicated Dim2 definition to make it distinct from size pairs with width and height swapped. Alternatives would be Index.Linear or intentionally complicated Shape types like:

type Dim0 = () type Dim1 = ((), Size) type Dim2 = ((), Size, Size)

Problems with Index.Linear is that it is fixed to Word32 dimensions which causes trouble with negative coordinates that we encounter on rotations.

The custom shape type requires lots of new definitions but it is certainly the cleanest solution.

type Dim0 = () Source

data Vec2 tag i Source

Constructors

Vec2 

Fields

vertical :: i
 
horizontal :: i
 

Instances

Storable n => Storable (Vec2 tag n) 
((~) * tag ShapeTag, C i) => C (Vec2 tag i) 
Compose n => Compose (Vec2 tag n) 
Decompose p => Decompose (Vec2 tag p) 
C i => C (Vec2 tag i) 
C n => C (Vec2 tag n) 
Compose n => Compose (Vec2 tag n) 
Decompose pn => Decompose (Vec2 tag pn) 
type Repr f (Vec2 tag n) = Vec2 tag (Repr f n) 
type Decomposed f (Vec2 tag pat) = Vec2 tag (Decomposed f pat) 
type Index (Vec2 tag i) = Index2 (Index i) 
type Composed (Vec2 tag n) = Vec2 tag (Composed n) 
type Struct (Vec2 tag i) = Struct (Struct i, (Struct i, ())) 
type Composed (Vec2 tag n) = Vec2 tag (Composed n) 
type PatternTuple (Vec2 tag pat) = Vec2 tag (PatternTuple pat) 

squareShape :: n -> Vec2 tag n Source

castToElemPtr :: Ptr (Vec2 tag a) -> Ptr a Source

unzipShape :: T (Vec2 tag n) -> Vec2 tag (T n) Source

zipShape :: T n -> T n -> T (Vec2 tag n) Source

verticalVal :: Value val => val (Vec2 tag n) -> val n Source

horizontalVal :: Value val => val (Vec2 tag n) -> val n Source