dense-0.1.0.0: Mutable and immutable dense multidimensional arrays

Copyright(c) Christopher Chalmers
LicenseBSD3
MaintainerChristopher Chalmers
Stabilityprovisional
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Data.Dense

Contents

Description

This module provides a large subset of the full functionality of "dense" without exporting names that conflict with names in prelude, so it can often be imported unqualified. It also includes reexported classes and data types from other modules. However it does not contain much functions necessary to construct arrays, for that see Data.Dense.Generic or one of the type specific modules intended to be imported qualified. Typical imports for shaped will look like this:

import           Data.Dense
import qualified Data.Dense.Unboxed as U

For boxed-specific arrays (a la Data.Vector) see Data.Dense.Boxed.

Synopsis

Array types

data Array v f a Source #

An Array is a vector with a shape.

Instances

Shape f => HasLayout f (Array v f a) Source #

The size of the layout must remain the same or an error is thrown.

Methods

layout :: Lens' (Array v f a) (Layout f) Source #

(Boxed v, Shape f) => FunctorWithIndex (f Int) (Array v f) Source # 

Methods

imap :: (f Int -> a -> b) -> Array v f a -> Array v f b #

imapped :: (Indexable (f Int) p, Settable f) => p a (f b) -> Array v f a -> f (Array v f b) #

(Boxed v, Shape f) => FoldableWithIndex (f Int) (Array v f) Source # 

Methods

ifoldMap :: Monoid m => (f Int -> a -> m) -> Array v f a -> m #

ifolded :: (Indexable (f Int) p, Contravariant f, Applicative f) => p a (f a) -> Array v f a -> f (Array v f a) #

ifoldr :: (f Int -> a -> b -> b) -> b -> Array v f a -> b #

ifoldl :: (f Int -> b -> a -> b) -> b -> Array v f a -> b #

ifoldr' :: (f Int -> a -> b -> b) -> b -> Array v f a -> b #

ifoldl' :: (f Int -> b -> a -> b) -> b -> Array v f a -> b #

(Boxed v, Shape f) => TraversableWithIndex (f Int) (Array v f) Source # 

Methods

itraverse :: Applicative f => (f Int -> a -> f b) -> Array v f a -> f (Array v f b) #

itraversed :: (Indexable (f Int) p, Applicative f) => p a (f b) -> Array v f a -> f (Array v f b) #

Boxed v => Functor (Array v f) Source # 

Methods

fmap :: (a -> b) -> Array v f a -> Array v f b #

(<$) :: a -> Array v f b -> Array v f a #

Boxed v => Foldable (Array v f) Source # 

Methods

fold :: Monoid m => Array v f m -> m #

foldMap :: Monoid m => (a -> m) -> Array v f a -> m #

foldr :: (a -> b -> b) -> b -> Array v f a -> b #

foldr' :: (a -> b -> b) -> b -> Array v f a -> b #

foldl :: (b -> a -> b) -> b -> Array v f a -> b #

foldl' :: (b -> a -> b) -> b -> Array v f a -> b #

foldr1 :: (a -> a -> a) -> Array v f a -> a #

foldl1 :: (a -> a -> a) -> Array v f a -> a #

toList :: Array v f a -> [a] #

null :: Array v f a -> Bool #

length :: Array v f a -> Int #

elem :: Eq a => a -> Array v f a -> Bool #

maximum :: Ord a => Array v f a -> a #

minimum :: Ord a => Array v f a -> a #

sum :: Num a => Array v f a -> a #

product :: Num a => Array v f a -> a #

Boxed v => Traversable (Array v f) Source # 

Methods

traverse :: Applicative f => (a -> f b) -> Array v f a -> f (Array v f b) #

sequenceA :: Applicative f => Array v f (f a) -> f (Array v f a) #

mapM :: Monad m => (a -> m b) -> Array v f a -> m (Array v f b) #

sequence :: Monad m => Array v f (m a) -> m (Array v f a) #

(Boxed v, Eq1 f) => Eq1 (Array v f) Source # 

Methods

liftEq :: (a -> b -> Bool) -> Array v f a -> Array v f b -> Bool #

(Boxed v, Read1 f) => Read1 (Array v f) Source # 

Methods

liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Array v f a) #

liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [Array v f a] #

(Boxed v, Shape f, Serial1 f) => Serial1 (Array v f) Source # 

Methods

serializeWith :: MonadPut m => (a -> m ()) -> Array v f a -> m () #

deserializeWith :: MonadGet m => m a -> m (Array v f a) #

(Vector v a, (~) (* -> *) f V1) => Vector (Array v f) a Source #

1D Arrays can be used as a generic Vector.

Methods

basicUnsafeFreeze :: PrimMonad m => Mutable (Array v f) (PrimState m) a -> m (Array v f a) #

basicUnsafeThaw :: PrimMonad m => Array v f a -> m (Mutable (Array v f) (PrimState m) a) #

basicLength :: Array v f a -> Int #

basicUnsafeSlice :: Int -> Int -> Array v f a -> Array v f a #

basicUnsafeIndexM :: Monad m => Array v f a -> Int -> m a #

basicUnsafeCopy :: PrimMonad m => Mutable (Array v f) (PrimState m) a -> Array v f a -> m () #

elemseq :: Array v f a -> a -> b -> b #

(Vector v a, Eq1 f, Eq a) => Eq (Array v f a) Source # 

Methods

(==) :: Array v f a -> Array v f a -> Bool #

(/=) :: Array v f a -> Array v f a -> Bool #

(Typeable (* -> *) f, Typeable (* -> *) v, Typeable * a, Data (f Int), Data (v a)) => Data (Array v f a) Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Array v f a -> c (Array v f a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Array v f a) #

toConstr :: Array v f a -> Constr #

dataTypeOf :: Array v f a -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (Array v f a)) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Array v f a)) #

gmapT :: (forall b. Data b => b -> b) -> Array v f a -> Array v f a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Array v f a -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Array v f a -> r #

gmapQ :: (forall d. Data d => d -> u) -> Array v f a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Array v f a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Array v f a -> m (Array v f a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Array v f a -> m (Array v f a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Array v f a -> m (Array v f a) #

(Vector v a, Read1 f, Read a) => Read (Array v f a) Source # 

Methods

readsPrec :: Int -> ReadS (Array v f a) #

readList :: ReadS [Array v f a] #

readPrec :: ReadPrec (Array v f a) #

readListPrec :: ReadPrec [Array v f a] #

(Vector v a, Show1 f, Show a) => Show (Array v f a) Source # 

Methods

showsPrec :: Int -> Array v f a -> ShowS #

show :: Array v f a -> String #

showList :: [Array v f a] -> ShowS #

(Vector v a, Shape f, Binary (f Int), Binary a) => Binary (Array v f a) Source # 

Methods

put :: Array v f a -> Put #

get :: Get (Array v f a) #

putList :: [Array v f a] -> Put #

(Vector v a, Shape f, Serial1 f, Serial a) => Serial (Array v f a) Source # 

Methods

serialize :: MonadPut m => Array v f a -> m () #

deserialize :: MonadGet m => m (Array v f a) #

(Vector v a, Shape f, Serialize (f Int), Serialize a) => Serialize (Array v f a) Source # 

Methods

put :: Putter (Array v f a) #

get :: Get (Array v f a) #

(NFData (f Int), NFData (v a)) => NFData (Array v f a) Source # 

Methods

rnf :: Array v f a -> () #

(Vector v a, Foldable f, Hashable a) => Hashable (Array v f a) Source # 

Methods

hashWithSalt :: Int -> Array v f a -> Int #

hash :: Array v f a -> Int #

(Shape f, Vector v a) => Ixed (Array v f a) Source # 

Methods

ix :: Index (Array v f a) -> Traversal' (Array v f a) (IxValue (Array v f a)) #

(Shape f, Vector v a) => AsEmpty (Array v f a) Source # 

Methods

_Empty :: Prism' (Array v f a) () #

(Vector v a, Vector v b) => Each (Array v f a) (Array v f b) a b Source # 

Methods

each :: Traversal (Array v f a) (Array v f b) a b #

type Mutable (Array v f) Source # 
type Mutable (Array v f) = MArray (Mutable v) f
type Index (Array v f a) Source # 
type Index (Array v f a) = f Int
type IxValue (Array v f a) Source # 
type IxValue (Array v f a) = a

type UArray = Array Vector Source #

Unboxed array.

Indexing

type Layout f = f Int Source #

A Layout is the full size of an array. This alias is used to help distinguish between the layout of an array and an index (usually just l Int) in a type signature.

class Shape f => HasLayout f a | a -> f where Source #

Class of things that have a Layout. This means we can use the same functions for the various different arrays in the library.

Methods

layout :: Lens' a (Layout f) Source #

Lens onto the Layout of something.

layout :: a ~ f Int => (Layout f -> g (Layout f)) -> a -> g a Source #

Lens onto the Layout of something.

Instances

(~) * i Int => HasLayout V4 (V4 i) Source # 

Methods

layout :: Lens' (V4 i) (Layout V4) Source #

(~) * i Int => HasLayout V3 (V3 i) Source # 

Methods

layout :: Lens' (V3 i) (Layout V3) Source #

(~) * i Int => HasLayout V2 (V2 i) Source # 

Methods

layout :: Lens' (V2 i) (Layout V2) Source #

(~) * i Int => HasLayout V1 (V1 i) Source # 

Methods

layout :: Lens' (V1 i) (Layout V1) Source #

(~) * i Int => HasLayout V0 (V0 i) Source # 

Methods

layout :: Lens' (V0 i) (Layout V0) Source #

Shape f => HasLayout f (Focused f a) Source #

The size of the layout must remain the same or an error is thrown.

Methods

layout :: Lens' (Focused f a) (Layout f) Source #

Shape f => HasLayout f (Delayed f a) Source #

The size of the layout must remain the same or an error is thrown.

Methods

layout :: Lens' (Delayed f a) (Layout f) Source #

Shape f => HasLayout f (Array v f a) Source #

The size of the layout must remain the same or an error is thrown.

Methods

layout :: Lens' (Array v f a) (Layout f) Source #

Shape f => HasLayout f (MArray v f s a) Source # 

Methods

layout :: Lens' (MArray v f s a) (Layout f) Source #

class (Eq1 f, Additive f, Traversable f) => Shape f Source #

Class for types that can be converted to and from linear indexes.

Instances

Shape V4 Source # 
Shape V3 Source # 
Shape V2 Source # 
Shape V1 Source # 
Shape V0 Source # 

extent :: HasLayout f a => a -> f Int Source #

Get the extent of an array.

extent :: Array v f a    -> f Int
extent :: MArray v f s a -> f Int
extent :: Delayed f a    -> f Int
extent :: Focused f a    -> f Int

size :: HasLayout f a => a -> Int Source #

Get the total number of elements in an array.

size :: Array v f a    -> Int
size :: MArray v f s a -> Int
size :: Delayed f a    -> Int
size :: Focused f a    -> Int

Folds over indexes

indexes :: HasLayout f a => IndexedFold Int a (f Int) Source #

Indexed fold for all the indexes in the layout.

indexesBetween :: HasLayout f a => f Int -> f Int -> IndexedFold Int a (f Int) Source #

Indexed fold between the two indexes where the index is the linear index for the original layout.

indexesFrom :: HasLayout f a => f Int -> IndexedFold Int a (f Int) Source #

Indexed fold starting starting from some point, where the index is the linear index for the original layout.

Lenses

vector :: (Vector v a, Vector w b) => IndexedLens (Layout f) (Array v f a) (Array w f b) (v a) (w b) Source #

Indexed lens over the underlying vector of an array. The index is the extent of the array. You must _not_ change the length of the vector, otherwise an error will be thrown (even for V1 layouts, use flat for V1).

Traversals

values :: (Shape f, Vector v a, Vector w b) => IndexedTraversal (f Int) (Array v f a) (Array w f b) a b Source #

Indexed traversal over the elements of an array. The index is the current position in the array.

values' :: (Shape f, Vector v a, Vector v b) => IndexedTraversal (f Int) (Array v f a) (Array v f b) a b Source #

Same as values but restrictive in the vector type.

valuesBetween :: (Shape f, Vector v a) => f Int -> f Int -> IndexedTraversal' (f Int) (Array v f a) a Source #

Traverse over the values between two indexes.

Construction

Flat arrays

flat :: Vector w b => Iso (Array v V1 a) (Array w V1 b) (v a) (w b) Source #

1D arrays are just vectors. You are free to change the length of the vector when going over this Iso (unlike linear).

Note that V1 arrays are an instance of Vector so you can use any of the functions in Data.Vector.Generic on them without needing to convert.

Shaped from lists

fromListInto :: (Shape f, Vector v a) => Layout f -> [a] -> Maybe (Array v f a) Source #

O(n) Convert the first n elements of a list to an Array with the given shape. Returns Nothing if there are not enough elements in the list.

fromListInto_ :: (Shape f, Vector v a) => Layout f -> [a] -> Array v f a Source #

O(n) Convert the first n elements of a list to an Array with the given shape. Throw an error if the list is not long enough.

Shaped from vectors

fromVectorInto :: (Shape f, Vector v a) => Layout f -> v a -> Maybe (Array v f a) Source #

Create an array from a vector and a layout. Return Nothing if the vector is not the right shape.

fromVectorInto_ :: (Shape f, Vector v a) => Layout f -> v a -> Array v f a Source #

Create an array from a vector and a layout. Throws an error if the vector is not the right shape.

Generating

Functions on arrays

Empty arrays

Indexing

See Ixed class.

Modifying arrays

Slices

Matrix

ixRow :: Vector v a => Int -> IndexedTraversal' Int (Array v V2 a) (v a) Source #

Affine traversal over a single row in a matrix.

>>> traverseOf_ rows print $ m & ixRow 1 . each *~ 2
[a,b,c,d]
[e * 2,f * 2,g * 2,h * 2]
[i,j,k,l]

The row vector should remain the same size to satisfy traversal laws but give reasonable behaviour if the size differs:

>>> traverseOf_ rows print $ m & ixRow 1 .~ B.fromList [0,1]
[a,b,c,d]
[0,1,g,h]
[i,j,k,l]
>>> traverseOf_ rows print $ m & ixRow 1 .~ B.fromList [0..100]
[a,b,c,d]
[0,1,2,3]
[i,j,k,l]

rows :: (Vector v a, Vector w b) => IndexedTraversal Int (Array v V2 a) (Array w V2 b) (v a) (w b) Source #

Indexed traversal over the rows of a matrix. Each row is an efficient slice of the original vector.

>>> traverseOf_ rows print m
[a,b,c,d]
[e,f,g,h]
[i,j,k,l]

ixColumn :: Vector v a => Int -> IndexedTraversal' Int (Array v V2 a) (v a) Source #

Affine traversal over a single column in a matrix.

>>> traverseOf_ rows print $ m & ixColumn 2 . each +~ 1
[a,b,c + 1,d]
[e,f,g + 1,h]
[i,j,k + 1,l]

columns :: (Vector v a, Vector w b) => IndexedTraversal Int (Array v V2 a) (Array w V2 b) (v a) (w b) Source #

Indexed traversal over the columns of a matrix. Unlike rows, each column is a new separate vector.

>>> traverseOf_ columns print m
[a,e,i]
[b,f,j]
[c,g,k]
[d,h,l]
>>> traverseOf_ rows print $ m & columns . indices odd . each .~ 0
[a,0,c,0]
[e,0,g,0]
[i,0,k,0]

The vectors should be the same size to be a valid traversal. If the vectors are different sizes, the number of rows in the new array will be the length of the smallest vector.

3D

ixPlane :: Vector v a => ALens' (V3 Int) (V2 Int) -> Int -> IndexedTraversal' Int (Array v V3 a) (Array v V2 a) Source #

Traversal over a single plane of a 3D array given a lens onto that plane (like _xy, _yz, _zx).

planes :: (Vector v a, Vector w b) => ALens' (V3 Int) (V2 Int) -> IndexedTraversal Int (Array v V3 a) (Array w V3 b) (Array v V2 a) (Array w V2 b) Source #

Traversal over all planes of 3D array given a lens onto that plane (like _xy, _yz, _zx).

flattenPlane :: (Vector v a, Vector w b) => ALens' (V3 Int) (V2 Int) -> (v a -> b) -> Array v V3 a -> Array w V2 b Source #

Flatten a plane by reducing a vector in the third dimension to a single value.

Mutable

data MArray v l s a Source #

A mutable array with a shape.

Instances

Shape f => HasLayout f (MArray v f s a) Source # 

Methods

layout :: Lens' (MArray v f s a) (Layout f) Source #

(MVector v a, (~) (* -> *) f V1) => MVector (MArray v f) a Source # 

Methods

basicLength :: MArray v f s a -> Int #

basicUnsafeSlice :: Int -> Int -> MArray v f s a -> MArray v f s a #

basicOverlaps :: MArray v f s a -> MArray v f s a -> Bool #

basicUnsafeNew :: PrimMonad m => Int -> m (MArray v f (PrimState m) a) #

basicInitialize :: PrimMonad m => MArray v f (PrimState m) a -> m () #

basicUnsafeReplicate :: PrimMonad m => Int -> a -> m (MArray v f (PrimState m) a) #

basicUnsafeRead :: PrimMonad m => MArray v f (PrimState m) a -> Int -> m a #

basicUnsafeWrite :: PrimMonad m => MArray v f (PrimState m) a -> Int -> a -> m () #

basicClear :: PrimMonad m => MArray v f (PrimState m) a -> m () #

basicSet :: PrimMonad m => MArray v f (PrimState m) a -> a -> m () #

basicUnsafeCopy :: PrimMonad m => MArray v f (PrimState m) a -> MArray v f (PrimState m) a -> m () #

basicUnsafeMove :: PrimMonad m => MArray v f (PrimState m) a -> MArray v f (PrimState m) a -> m () #

basicUnsafeGrow :: PrimMonad m => MArray v f (PrimState m) a -> Int -> m (MArray v f (PrimState m) a) #

type BMArray = MArray MVector Source #

Boxed mutable array.

type UMArray = MArray MVector Source #

Unboxed mutable array.

type SMArray = MArray MVector Source #

Storable mutable array.

type PMArray = MArray MVector Source #

Primitive mutable array.

Delayed

data Delayed f a Source #

A delayed representation of an array. This useful for mapping over an array in parallel.

Instances

Shape f => HasLayout f (Delayed f a) Source #

The size of the layout must remain the same or an error is thrown.

Methods

layout :: Lens' (Delayed f a) (Layout f) Source #

Functor (Delayed f) Source # 

Methods

fmap :: (a -> b) -> Delayed f a -> Delayed f b #

(<$) :: a -> Delayed f b -> Delayed f a #

Shape f => Foldable (Delayed f) Source #

foldMap in parallel.

Methods

fold :: Monoid m => Delayed f m -> m #

foldMap :: Monoid m => (a -> m) -> Delayed f a -> m #

foldr :: (a -> b -> b) -> b -> Delayed f a -> b #

foldr' :: (a -> b -> b) -> b -> Delayed f a -> b #

foldl :: (b -> a -> b) -> b -> Delayed f a -> b #

foldl' :: (b -> a -> b) -> b -> Delayed f a -> b #

foldr1 :: (a -> a -> a) -> Delayed f a -> a #

foldl1 :: (a -> a -> a) -> Delayed f a -> a #

toList :: Delayed f a -> [a] #

null :: Delayed f a -> Bool #

length :: Delayed f a -> Int #

elem :: Eq a => a -> Delayed f a -> Bool #

maximum :: Ord a => Delayed f a -> a #

minimum :: Ord a => Delayed f a -> a #

sum :: Num a => Delayed f a -> a #

product :: Num a => Delayed f a -> a #

Shape f => Traversable (Delayed f) Source # 

Methods

traverse :: Applicative f => (a -> f b) -> Delayed f a -> f (Delayed f b) #

sequenceA :: Applicative f => Delayed f (f a) -> f (Delayed f a) #

mapM :: Monad m => (a -> m b) -> Delayed f a -> m (Delayed f b) #

sequence :: Monad m => Delayed f (m a) -> m (Delayed f a) #

Shape f => Metric (Delayed f) Source # 

Methods

dot :: Num a => Delayed f a -> Delayed f a -> a #

quadrance :: Num a => Delayed f a -> a #

qd :: Num a => Delayed f a -> Delayed f a -> a #

distance :: Floating a => Delayed f a -> Delayed f a -> a #

norm :: Floating a => Delayed f a -> a #

signorm :: Floating a => Delayed f a -> Delayed f a #

Shape f => Additive (Delayed f) Source # 

Methods

zero :: Num a => Delayed f a #

(^+^) :: Num a => Delayed f a -> Delayed f a -> Delayed f a #

(^-^) :: Num a => Delayed f a -> Delayed f a -> Delayed f a #

lerp :: Num a => a -> Delayed f a -> Delayed f a -> Delayed f a #

liftU2 :: (a -> a -> a) -> Delayed f a -> Delayed f a -> Delayed f a #

liftI2 :: (a -> b -> c) -> Delayed f a -> Delayed f b -> Delayed f c #

Shape f => Apply (Delayed f) Source # 

Methods

(<.>) :: Delayed f (a -> b) -> Delayed f a -> Delayed f b #

(.>) :: Delayed f a -> Delayed f b -> Delayed f b #

(<.) :: Delayed f a -> Delayed f b -> Delayed f a #

FunctorWithIndex (f Int) (Delayed f) Source # 

Methods

imap :: (f Int -> a -> b) -> Delayed f a -> Delayed f b #

imapped :: (Indexable (f Int) p, Settable f) => p a (f b) -> Delayed f a -> f (Delayed f b) #

Shape f => FoldableWithIndex (f Int) (Delayed f) Source #

ifoldMap in parallel.

Methods

ifoldMap :: Monoid m => (f Int -> a -> m) -> Delayed f a -> m #

ifolded :: (Indexable (f Int) p, Contravariant f, Applicative f) => p a (f a) -> Delayed f a -> f (Delayed f a) #

ifoldr :: (f Int -> a -> b -> b) -> b -> Delayed f a -> b #

ifoldl :: (f Int -> b -> a -> b) -> b -> Delayed f a -> b #

ifoldr' :: (f Int -> a -> b -> b) -> b -> Delayed f a -> b #

ifoldl' :: (f Int -> b -> a -> b) -> b -> Delayed f a -> b #

Shape f => TraversableWithIndex (f Int) (Delayed f) Source # 

Methods

itraverse :: Applicative f => (f Int -> a -> f b) -> Delayed f a -> f (Delayed f b) #

itraversed :: (Indexable (f Int) p, Applicative f) => p a (f b) -> Delayed f a -> f (Delayed f b) #

(Shape f, Show1 f, Show a) => Show (Delayed f a) Source # 

Methods

showsPrec :: Int -> Delayed f a -> ShowS #

show :: Delayed f a -> String #

showList :: [Delayed f a] -> ShowS #

Shape f => Ixed (Delayed f a) Source # 

Methods

ix :: Index (Delayed f a) -> Traversal' (Delayed f a) (IxValue (Delayed f a)) #

Shape f => AsEmpty (Delayed f a) Source # 

Methods

_Empty :: Prism' (Delayed f a) () #

Shape f => Each (Delayed f a) (Delayed f b) a b Source # 

Methods

each :: Traversal (Delayed f a) (Delayed f b) a b #

type Index (Delayed f a) Source # 
type Index (Delayed f a) = f Int
type IxValue (Delayed f a) Source # 
type IxValue (Delayed f a) = a

Generating delayed

delayed :: (Vector v a, Vector w b, Shape f, Shape g) => Iso (Array v f a) (Array w g b) (Delayed f a) (Delayed g b) Source #

Isomorphism between an array and its delayed representation. Conversion to the array is done in parallel.

seqDelayed :: (Vector v a, Vector w b, Shape f, Shape g) => Iso (Array v f a) (Array w g b) (Delayed f a) (Delayed g b) Source #

Isomorphism between an array and its delayed representation. Conversion to the array is done in parallel.

delay :: (Vector v a, Shape f) => Array v f a -> Delayed f a Source #

Turn a material array into a delayed one with the same shape.

manifest :: (Vector v a, Shape f) => Delayed f a -> Array v f a Source #

Parallel manifestation of a delayed array into a material one.

seqManifest :: (Vector v a, Shape f) => Delayed f a -> Array v f a Source #

Sequential manifestation of a delayed array.

genDelayed :: Layout f -> (f Int -> a) -> Delayed f a Source #

Generate a Delayed array using the given Layout and construction function.

indexDelayed :: Shape f => Delayed f a -> f Int -> a Source #

Index a delayed array, returning a IndexOutOfBounds exception if the index is out of range.

affirm :: (Shape f, Unbox a) => Delayed f a -> Delayed f a Source #

manifest an array to a UArray and delay again. See Data.Dense.Boxed or Data.Dense.Storable to affirm for other types of arrays.

seqAffirm :: (Shape f, Unbox a) => Delayed f a -> Delayed f a Source #

seqManifest an array to a UArray and delay again. See Data.Dense.Boxed or Data.Dense.Storable to affirm for other types of arrays.

Helpful reexports

(*^) :: (Functor f, Num a) => a -> f a -> f a infixl 7 #

Compute the left scalar product

>>> 2 *^ V2 3 4
V2 6 8

(^*) :: (Functor f, Num a) => f a -> a -> f a infixl 7 #

Compute the right scalar product

>>> V2 3 4 ^* 2
V2 6 8

(^/) :: (Functor f, Fractional a) => f a -> a -> f a infixl 7 #

Compute division by a scalar on the right.

class Functor f => Additive f where #

A vector is an additive group with additional structure.

Minimal complete definition

Nothing

Instances

Additive [] 

Methods

zero :: Num a => [a] #

(^+^) :: Num a => [a] -> [a] -> [a] #

(^-^) :: Num a => [a] -> [a] -> [a] #

lerp :: Num a => a -> [a] -> [a] -> [a] #

liftU2 :: (a -> a -> a) -> [a] -> [a] -> [a] #

liftI2 :: (a -> b -> c) -> [a] -> [b] -> [c] #

Additive Maybe 

Methods

zero :: Num a => Maybe a #

(^+^) :: Num a => Maybe a -> Maybe a -> Maybe a #

(^-^) :: Num a => Maybe a -> Maybe a -> Maybe a #

lerp :: Num a => a -> Maybe a -> Maybe a -> Maybe a #

liftU2 :: (a -> a -> a) -> Maybe a -> Maybe a -> Maybe a #

liftI2 :: (a -> b -> c) -> Maybe a -> Maybe b -> Maybe c #

Additive Identity 

Methods

zero :: Num a => Identity a #

(^+^) :: Num a => Identity a -> Identity a -> Identity a #

(^-^) :: Num a => Identity a -> Identity a -> Identity a #

lerp :: Num a => a -> Identity a -> Identity a -> Identity a #

liftU2 :: (a -> a -> a) -> Identity a -> Identity a -> Identity a #

liftI2 :: (a -> b -> c) -> Identity a -> Identity b -> Identity c #

Additive Complex 

Methods

zero :: Num a => Complex a #

(^+^) :: Num a => Complex a -> Complex a -> Complex a #

(^-^) :: Num a => Complex a -> Complex a -> Complex a #

lerp :: Num a => a -> Complex a -> Complex a -> Complex a #

liftU2 :: (a -> a -> a) -> Complex a -> Complex a -> Complex a #

liftI2 :: (a -> b -> c) -> Complex a -> Complex b -> Complex c #

Additive ZipList 

Methods

zero :: Num a => ZipList a #

(^+^) :: Num a => ZipList a -> ZipList a -> ZipList a #

(^-^) :: Num a => ZipList a -> ZipList a -> ZipList a #

lerp :: Num a => a -> ZipList a -> ZipList a -> ZipList a #

liftU2 :: (a -> a -> a) -> ZipList a -> ZipList a -> ZipList a #

liftI2 :: (a -> b -> c) -> ZipList a -> ZipList b -> ZipList c #

Additive IntMap 

Methods

zero :: Num a => IntMap a #

(^+^) :: Num a => IntMap a -> IntMap a -> IntMap a #

(^-^) :: Num a => IntMap a -> IntMap a -> IntMap a #

lerp :: Num a => a -> IntMap a -> IntMap a -> IntMap a #

liftU2 :: (a -> a -> a) -> IntMap a -> IntMap a -> IntMap a #

liftI2 :: (a -> b -> c) -> IntMap a -> IntMap b -> IntMap c #

Additive Vector 

Methods

zero :: Num a => Vector a #

(^+^) :: Num a => Vector a -> Vector a -> Vector a #

(^-^) :: Num a => Vector a -> Vector a -> Vector a #

lerp :: Num a => a -> Vector a -> Vector a -> Vector a #

liftU2 :: (a -> a -> a) -> Vector a -> Vector a -> Vector a #

liftI2 :: (a -> b -> c) -> Vector a -> Vector b -> Vector c #

Additive Quaternion 

Methods

zero :: Num a => Quaternion a #

(^+^) :: Num a => Quaternion a -> Quaternion a -> Quaternion a #

(^-^) :: Num a => Quaternion a -> Quaternion a -> Quaternion a #

lerp :: Num a => a -> Quaternion a -> Quaternion a -> Quaternion a #

liftU2 :: (a -> a -> a) -> Quaternion a -> Quaternion a -> Quaternion a #

liftI2 :: (a -> b -> c) -> Quaternion a -> Quaternion b -> Quaternion c #

Additive Plucker 

Methods

zero :: Num a => Plucker a #

(^+^) :: Num a => Plucker a -> Plucker a -> Plucker a #

(^-^) :: Num a => Plucker a -> Plucker a -> Plucker a #

lerp :: Num a => a -> Plucker a -> Plucker a -> Plucker a #

liftU2 :: (a -> a -> a) -> Plucker a -> Plucker a -> Plucker a #

liftI2 :: (a -> b -> c) -> Plucker a -> Plucker b -> Plucker c #

Additive V4 

Methods

zero :: Num a => V4 a #

(^+^) :: Num a => V4 a -> V4 a -> V4 a #

(^-^) :: Num a => V4 a -> V4 a -> V4 a #

lerp :: Num a => a -> V4 a -> V4 a -> V4 a #

liftU2 :: (a -> a -> a) -> V4 a -> V4 a -> V4 a #

liftI2 :: (a -> b -> c) -> V4 a -> V4 b -> V4 c #

Additive V3 

Methods

zero :: Num a => V3 a #

(^+^) :: Num a => V3 a -> V3 a -> V3 a #

(^-^) :: Num a => V3 a -> V3 a -> V3 a #

lerp :: Num a => a -> V3 a -> V3 a -> V3 a #

liftU2 :: (a -> a -> a) -> V3 a -> V3 a -> V3 a #

liftI2 :: (a -> b -> c) -> V3 a -> V3 b -> V3 c #

Additive V2 

Methods

zero :: Num a => V2 a #

(^+^) :: Num a => V2 a -> V2 a -> V2 a #

(^-^) :: Num a => V2 a -> V2 a -> V2 a #

lerp :: Num a => a -> V2 a -> V2 a -> V2 a #

liftU2 :: (a -> a -> a) -> V2 a -> V2 a -> V2 a #

liftI2 :: (a -> b -> c) -> V2 a -> V2 b -> V2 c #

Additive V1 

Methods

zero :: Num a => V1 a #

(^+^) :: Num a => V1 a -> V1 a -> V1 a #

(^-^) :: Num a => V1 a -> V1 a -> V1 a #

lerp :: Num a => a -> V1 a -> V1 a -> V1 a #

liftU2 :: (a -> a -> a) -> V1 a -> V1 a -> V1 a #

liftI2 :: (a -> b -> c) -> V1 a -> V1 b -> V1 c #

Additive V0 

Methods

zero :: Num a => V0 a #

(^+^) :: Num a => V0 a -> V0 a -> V0 a #

(^-^) :: Num a => V0 a -> V0 a -> V0 a #

lerp :: Num a => a -> V0 a -> V0 a -> V0 a #

liftU2 :: (a -> a -> a) -> V0 a -> V0 a -> V0 a #

liftI2 :: (a -> b -> c) -> V0 a -> V0 b -> V0 c #

Additive ((->) b) 

Methods

zero :: Num a => b -> a #

(^+^) :: Num a => (b -> a) -> (b -> a) -> b -> a #

(^-^) :: Num a => (b -> a) -> (b -> a) -> b -> a #

lerp :: Num a => a -> (b -> a) -> (b -> a) -> b -> a #

liftU2 :: (a -> a -> a) -> (b -> a) -> (b -> a) -> b -> a #

liftI2 :: (a -> b -> c) -> (b -> a) -> (b -> b) -> b -> c #

Ord k => Additive (Map k) 

Methods

zero :: Num a => Map k a #

(^+^) :: Num a => Map k a -> Map k a -> Map k a #

(^-^) :: Num a => Map k a -> Map k a -> Map k a #

lerp :: Num a => a -> Map k a -> Map k a -> Map k a #

liftU2 :: (a -> a -> a) -> Map k a -> Map k a -> Map k a #

liftI2 :: (a -> b -> c) -> Map k a -> Map k b -> Map k c #

(Eq k, Hashable k) => Additive (HashMap k) 

Methods

zero :: Num a => HashMap k a #

(^+^) :: Num a => HashMap k a -> HashMap k a -> HashMap k a #

(^-^) :: Num a => HashMap k a -> HashMap k a -> HashMap k a #

lerp :: Num a => a -> HashMap k a -> HashMap k a -> HashMap k a #

liftU2 :: (a -> a -> a) -> HashMap k a -> HashMap k a -> HashMap k a #

liftI2 :: (a -> b -> c) -> HashMap k a -> HashMap k b -> HashMap k c #

Shape f => Additive (Delayed f) # 

Methods

zero :: Num a => Delayed f a #

(^+^) :: Num a => Delayed f a -> Delayed f a -> Delayed f a #

(^-^) :: Num a => Delayed f a -> Delayed f a -> Delayed f a #

lerp :: Num a => a -> Delayed f a -> Delayed f a -> Delayed f a #

liftU2 :: (a -> a -> a) -> Delayed f a -> Delayed f a -> Delayed f a #

liftI2 :: (a -> b -> c) -> Delayed f a -> Delayed f b -> Delayed f c #

Dim k n => Additive (V k n) 

Methods

zero :: Num a => V k n a #

(^+^) :: Num a => V k n a -> V k n a -> V k n a #

(^-^) :: Num a => V k n a -> V k n a -> V k n a #

lerp :: Num a => a -> V k n a -> V k n a -> V k n a #

liftU2 :: (a -> a -> a) -> V k n a -> V k n a -> V k n a #

liftI2 :: (a -> b -> c) -> V k n a -> V k n b -> V k n c #

class Additive f => Metric f where #

Free and sparse inner product/metric spaces.

Minimal complete definition

Nothing

Instances

Metric [] 

Methods

dot :: Num a => [a] -> [a] -> a #

quadrance :: Num a => [a] -> a #

qd :: Num a => [a] -> [a] -> a #

distance :: Floating a => [a] -> [a] -> a #

norm :: Floating a => [a] -> a #

signorm :: Floating a => [a] -> [a] #

Metric Maybe 

Methods

dot :: Num a => Maybe a -> Maybe a -> a #

quadrance :: Num a => Maybe a -> a #

qd :: Num a => Maybe a -> Maybe a -> a #

distance :: Floating a => Maybe a -> Maybe a -> a #

norm :: Floating a => Maybe a -> a #

signorm :: Floating a => Maybe a -> Maybe a #

Metric Identity 

Methods

dot :: Num a => Identity a -> Identity a -> a #

quadrance :: Num a => Identity a -> a #

qd :: Num a => Identity a -> Identity a -> a #

distance :: Floating a => Identity a -> Identity a -> a #

norm :: Floating a => Identity a -> a #

signorm :: Floating a => Identity a -> Identity a #

Metric ZipList 

Methods

dot :: Num a => ZipList a -> ZipList a -> a #

quadrance :: Num a => ZipList a -> a #

qd :: Num a => ZipList a -> ZipList a -> a #

distance :: Floating a => ZipList a -> ZipList a -> a #

norm :: Floating a => ZipList a -> a #

signorm :: Floating a => ZipList a -> ZipList a #

Metric IntMap 

Methods

dot :: Num a => IntMap a -> IntMap a -> a #

quadrance :: Num a => IntMap a -> a #

qd :: Num a => IntMap a -> IntMap a -> a #

distance :: Floating a => IntMap a -> IntMap a -> a #

norm :: Floating a => IntMap a -> a #

signorm :: Floating a => IntMap a -> IntMap a #

Metric Vector 

Methods

dot :: Num a => Vector a -> Vector a -> a #

quadrance :: Num a => Vector a -> a #

qd :: Num a => Vector a -> Vector a -> a #

distance :: Floating a => Vector a -> Vector a -> a #

norm :: Floating a => Vector a -> a #

signorm :: Floating a => Vector a -> Vector a #

Metric Quaternion 

Methods

dot :: Num a => Quaternion a -> Quaternion a -> a #

quadrance :: Num a => Quaternion a -> a #

qd :: Num a => Quaternion a -> Quaternion a -> a #

distance :: Floating a => Quaternion a -> Quaternion a -> a #

norm :: Floating a => Quaternion a -> a #

signorm :: Floating a => Quaternion a -> Quaternion a #

Metric Plucker 

Methods

dot :: Num a => Plucker a -> Plucker a -> a #

quadrance :: Num a => Plucker a -> a #

qd :: Num a => Plucker a -> Plucker a -> a #

distance :: Floating a => Plucker a -> Plucker a -> a #

norm :: Floating a => Plucker a -> a #

signorm :: Floating a => Plucker a -> Plucker a #

Metric V4 

Methods

dot :: Num a => V4 a -> V4 a -> a #

quadrance :: Num a => V4 a -> a #

qd :: Num a => V4 a -> V4 a -> a #

distance :: Floating a => V4 a -> V4 a -> a #

norm :: Floating a => V4 a -> a #

signorm :: Floating a => V4 a -> V4 a #

Metric V3 

Methods

dot :: Num a => V3 a -> V3 a -> a #

quadrance :: Num a => V3 a -> a #

qd :: Num a => V3 a -> V3 a -> a #

distance :: Floating a => V3 a -> V3 a -> a #

norm :: Floating a => V3 a -> a #

signorm :: Floating a => V3 a -> V3 a #

Metric V2 

Methods

dot :: Num a => V2 a -> V2 a -> a #

quadrance :: Num a => V2 a -> a #

qd :: Num a => V2 a -> V2 a -> a #

distance :: Floating a => V2 a -> V2 a -> a #

norm :: Floating a => V2 a -> a #

signorm :: Floating a => V2 a -> V2 a #

Metric V1 

Methods

dot :: Num a => V1 a -> V1 a -> a #

quadrance :: Num a => V1 a -> a #

qd :: Num a => V1 a -> V1 a -> a #

distance :: Floating a => V1 a -> V1 a -> a #

norm :: Floating a => V1 a -> a #

signorm :: Floating a => V1 a -> V1 a #

Metric V0 

Methods

dot :: Num a => V0 a -> V0 a -> a #

quadrance :: Num a => V0 a -> a #

qd :: Num a => V0 a -> V0 a -> a #

distance :: Floating a => V0 a -> V0 a -> a #

norm :: Floating a => V0 a -> a #

signorm :: Floating a => V0 a -> V0 a #

Ord k => Metric (Map k) 

Methods

dot :: Num a => Map k a -> Map k a -> a #

quadrance :: Num a => Map k a -> a #

qd :: Num a => Map k a -> Map k a -> a #

distance :: Floating a => Map k a -> Map k a -> a #

norm :: Floating a => Map k a -> a #

signorm :: Floating a => Map k a -> Map k a #

(Hashable k, Eq k) => Metric (HashMap k) 

Methods

dot :: Num a => HashMap k a -> HashMap k a -> a #

quadrance :: Num a => HashMap k a -> a #

qd :: Num a => HashMap k a -> HashMap k a -> a #

distance :: Floating a => HashMap k a -> HashMap k a -> a #

norm :: Floating a => HashMap k a -> a #

signorm :: Floating a => HashMap k a -> HashMap k a #

Shape f => Metric (Delayed f) # 

Methods

dot :: Num a => Delayed f a -> Delayed f a -> a #

quadrance :: Num a => Delayed f a -> a #

qd :: Num a => Delayed f a -> Delayed f a -> a #

distance :: Floating a => Delayed f a -> Delayed f a -> a #

norm :: Floating a => Delayed f a -> a #

signorm :: Floating a => Delayed f a -> Delayed f a #

Dim k n => Metric (V k n) 

Methods

dot :: Num a => V k n a -> V k n a -> a #

quadrance :: Num a => V k n a -> a #

qd :: Num a => V k n a -> V k n a -> a #

distance :: Floating a => V k n a -> V k n a -> a #

norm :: Floating a => V k n a -> a #

signorm :: Floating a => V k n a -> V k n a #

Focused

data Focused f a Source #

A delayed representation of an array with a focus on a single element. This element is the target of extract.

Instances

Shape f => HasLayout f (Focused f a) Source #

The size of the layout must remain the same or an error is thrown.

Methods

layout :: Lens' (Focused f a) (Layout f) Source #

Functor (Focused f) Source # 

Methods

fmap :: (a -> b) -> Focused f a -> Focused f b #

(<$) :: a -> Focused f b -> Focused f a #

Shape f => Foldable (Focused f) Source # 

Methods

fold :: Monoid m => Focused f m -> m #

foldMap :: Monoid m => (a -> m) -> Focused f a -> m #

foldr :: (a -> b -> b) -> b -> Focused f a -> b #

foldr' :: (a -> b -> b) -> b -> Focused f a -> b #

foldl :: (b -> a -> b) -> b -> Focused f a -> b #

foldl' :: (b -> a -> b) -> b -> Focused f a -> b #

foldr1 :: (a -> a -> a) -> Focused f a -> a #

foldl1 :: (a -> a -> a) -> Focused f a -> a #

toList :: Focused f a -> [a] #

null :: Focused f a -> Bool #

length :: Focused f a -> Int #

elem :: Eq a => a -> Focused f a -> Bool #

maximum :: Ord a => Focused f a -> a #

minimum :: Ord a => Focused f a -> a #

sum :: Num a => Focused f a -> a #

product :: Num a => Focused f a -> a #

Shape f => Traversable (Focused f) Source # 

Methods

traverse :: Applicative f => (a -> f b) -> Focused f a -> f (Focused f b) #

sequenceA :: Applicative f => Focused f (f a) -> f (Focused f a) #

mapM :: Monad m => (a -> m b) -> Focused f a -> m (Focused f b) #

sequence :: Monad m => Focused f (m a) -> m (Focused f a) #

Shape f => Comonad (Focused f) Source # 

Methods

extract :: Focused f a -> a #

duplicate :: Focused f a -> Focused f (Focused f a) #

extend :: (Focused f a -> b) -> Focused f a -> Focused f b #

Shape f => Extend (Focused f) Source # 

Methods

duplicated :: Focused f a -> Focused f (Focused f a) #

extended :: (Focused f a -> b) -> Focused f a -> Focused f b #

Shape f => ComonadStore (f Int) (Focused f) Source # 

Methods

pos :: Focused f a -> f Int #

peek :: f Int -> Focused f a -> a #

peeks :: (f Int -> f Int) -> Focused f a -> a #

seek :: f Int -> Focused f a -> Focused f a #

seeks :: (f Int -> f Int) -> Focused f a -> Focused f a #

experiment :: Functor f => (f Int -> f (f Int)) -> Focused f a -> f a #

Shape f => FunctorWithIndex (f Int) (Focused f) Source #

Index relative to focus.

Methods

imap :: (f Int -> a -> b) -> Focused f a -> Focused f b #

imapped :: (Indexable (f Int) p, Settable f) => p a (f b) -> Focused f a -> f (Focused f b) #

Shape f => FoldableWithIndex (f Int) (Focused f) Source #

Index relative to focus.

Methods

ifoldMap :: Monoid m => (f Int -> a -> m) -> Focused f a -> m #

ifolded :: (Indexable (f Int) p, Contravariant f, Applicative f) => p a (f a) -> Focused f a -> f (Focused f a) #

ifoldr :: (f Int -> a -> b -> b) -> b -> Focused f a -> b #

ifoldl :: (f Int -> b -> a -> b) -> b -> Focused f a -> b #

ifoldr' :: (f Int -> a -> b -> b) -> b -> Focused f a -> b #

ifoldl' :: (f Int -> b -> a -> b) -> b -> Focused f a -> b #

Shape f => TraversableWithIndex (f Int) (Focused f) Source #

Index relative to focus.

Methods

itraverse :: Applicative f => (f Int -> a -> f b) -> Focused f a -> f (Focused f b) #

itraversed :: (Indexable (f Int) p, Applicative f) => p a (f b) -> Focused f a -> f (Focused f b) #

(Shape f, Show1 f, Show a) => Show (Focused f a) Source # 

Methods

showsPrec :: Int -> Focused f a -> ShowS #

show :: Focused f a -> String #

showList :: [Focused f a] -> ShowS #

Shape f => Ixed (Focused f a) Source #

Index relative to focus.

Methods

ix :: Index (Focused f a) -> Traversal' (Focused f a) (IxValue (Focused f a)) #

type Index (Focused f a) Source # 
type Index (Focused f a) = f Int
type IxValue (Focused f a) Source # 
type IxValue (Focused f a) = a

Generating focused

focusOn :: f Int -> Delayed f a -> Focused f a Source #

Focus on a particular element of a delayed array.

unfocus :: Focused f a -> Delayed f a Source #

Discard the focus to retrieve the delayed array.

unfocused :: IndexedLens (f Int) (Focused f a) (Focused f b) (Delayed f a) (Delayed f b) Source #

Indexed lens onto the delayed array, indexed at the focus.

extendFocus :: Shape f => (Focused f a -> b) -> Delayed f a -> Delayed f b Source #

Modify a Delayed array by extracting a value from a Focused each point.

Focus location

locale :: ComonadStore s w => Lens' (w a) s Source #

Lens onto the position of a ComonadStore.

locale :: Lens' (Focused l a) (l Int)

shiftFocus :: Applicative f => f Int -> Focused f a -> Focused f a Source #

Focus on a neighbouring element, relative to the current focus.

Boundary

data Boundary Source #

The boundary condition used for indexing relative elements in a Focused.

Constructors

Clamp

clamp coordinates to the extent of the array

Mirror

mirror coordinates beyond the array extent

Wrap

wrap coordinates around on each dimension

peekB :: Shape f => Boundary -> f Int -> Focused f a -> a Source #

Index a focused using a Boundary condition.

peeksB :: Shape f => Boundary -> (f Int -> f Int) -> Focused f a -> a Source #

Index an element by applying a function the current position, using a boundary condition.

peekRelativeB :: Shape f => Boundary -> f Int -> Focused f a -> a Source #

Index an element relative to the current focus using a Boundary condition.

Helpful reexports

class Functor w => Comonad w where #

There are two ways to define a comonad:

I. Provide definitions for extract and extend satisfying these laws:

extend extract      = id
extract . extend f  = f
extend f . extend g = extend (f . extend g)

In this case, you may simply set fmap = liftW.

These laws are directly analogous to the laws for monads and perhaps can be made clearer by viewing them as laws stating that Cokleisli composition must be associative, and has extract for a unit:

f =>= extract   = f
extract =>= f   = f
(f =>= g) =>= h = f =>= (g =>= h)

II. Alternately, you may choose to provide definitions for fmap, extract, and duplicate satisfying these laws:

extract . duplicate      = id
fmap extract . duplicate = id
duplicate . duplicate    = fmap duplicate . duplicate

In this case you may not rely on the ability to define fmap in terms of liftW.

You may of course, choose to define both duplicate and extend. In that case you must also satisfy these laws:

extend f  = fmap f . duplicate
duplicate = extend id
fmap f    = extend (f . extract)

These are the default definitions of extend and duplicate and the definition of liftW respectively.

Minimal complete definition

extract, (duplicate | extend)

Instances

Comonad Identity 

Methods

extract :: Identity a -> a #

duplicate :: Identity a -> Identity (Identity a) #

extend :: (Identity a -> b) -> Identity a -> Identity b #

Comonad NonEmpty 

Methods

extract :: NonEmpty a -> a #

duplicate :: NonEmpty a -> NonEmpty (NonEmpty a) #

extend :: (NonEmpty a -> b) -> NonEmpty a -> NonEmpty b #

Comonad Tree 

Methods

extract :: Tree a -> a #

duplicate :: Tree a -> Tree (Tree a) #

extend :: (Tree a -> b) -> Tree a -> Tree b #

Monoid m => Comonad ((->) m) 

Methods

extract :: (m -> a) -> a #

duplicate :: (m -> a) -> m -> m -> a #

extend :: ((m -> a) -> b) -> (m -> a) -> m -> b #

Comonad ((,) e) 

Methods

extract :: (e, a) -> a #

duplicate :: (e, a) -> (e, (e, a)) #

extend :: ((e, a) -> b) -> (e, a) -> (e, b) #

(Representable f, Monoid (Rep f)) => Comonad (Co f) 

Methods

extract :: Co f a -> a #

duplicate :: Co f a -> Co f (Co f a) #

extend :: (Co f a -> b) -> Co f a -> Co f b #

Comonad (Arg e) 

Methods

extract :: Arg e a -> a #

duplicate :: Arg e a -> Arg e (Arg e a) #

extend :: (Arg e a -> b) -> Arg e a -> Arg e b #

Functor f => Comonad (Cofree f) 

Methods

extract :: Cofree f a -> a #

duplicate :: Cofree f a -> Cofree f (Cofree f a) #

extend :: (Cofree f a -> b) -> Cofree f a -> Cofree f b #

Comonad w => Comonad (Yoneda w) 

Methods

extract :: Yoneda w a -> a #

duplicate :: Yoneda w a -> Yoneda w (Yoneda w a) #

extend :: (Yoneda w a -> b) -> Yoneda w a -> Yoneda w b #

Monoid s => Comonad (ReifiedGetter s) 
Comonad f => Comonad (MaybeApply f) 

Methods

extract :: MaybeApply f a -> a #

duplicate :: MaybeApply f a -> MaybeApply f (MaybeApply f a) #

extend :: (MaybeApply f a -> b) -> MaybeApply f a -> MaybeApply f b #

Shape f => Comonad (Focused f) # 

Methods

extract :: Focused f a -> a #

duplicate :: Focused f a -> Focused f (Focused f a) #

extend :: (Focused f a -> b) -> Focused f a -> Focused f b #

(Comonad w, Monoid m) => Comonad (TracedT m w) 

Methods

extract :: TracedT m w a -> a #

duplicate :: TracedT m w a -> TracedT m w (TracedT m w a) #

extend :: (TracedT m w a -> b) -> TracedT m w a -> TracedT m w b #

Comonad w => Comonad (StoreT s w) 

Methods

extract :: StoreT s w a -> a #

duplicate :: StoreT s w a -> StoreT s w (StoreT s w a) #

extend :: (StoreT s w a -> b) -> StoreT s w a -> StoreT s w b #

Comonad w => Comonad (EnvT e w) 

Methods

extract :: EnvT e w a -> a #

duplicate :: EnvT e w a -> EnvT e w (EnvT e w a) #

extend :: (EnvT e w a -> b) -> EnvT e w a -> EnvT e w b #

Comonad w => Comonad (IdentityT * w) 

Methods

extract :: IdentityT * w a -> a #

duplicate :: IdentityT * w a -> IdentityT * w (IdentityT * w a) #

extend :: (IdentityT * w a -> b) -> IdentityT * w a -> IdentityT * w b #

(~) * a b => Comonad (Context a b) 

Methods

extract :: Context a b a -> a #

duplicate :: Context a b a -> Context a b (Context a b a) #

extend :: (Context a b a -> b) -> Context a b a -> Context a b b #

Comonad (Tagged * s) 

Methods

extract :: Tagged * s a -> a #

duplicate :: Tagged * s a -> Tagged * s (Tagged * s a) #

extend :: (Tagged * s a -> b) -> Tagged * s a -> Tagged * s b #

(Comonad f, Comonad g) => Comonad (Sum * f g) 

Methods

extract :: Sum * f g a -> a #

duplicate :: Sum * f g a -> Sum * f g (Sum * f g a) #

extend :: (Sum * f g a -> b) -> Sum * f g a -> Sum * f g b #

(~) * a b => Comonad (Molten i a b) 

Methods

extract :: Molten i a b a -> a #

duplicate :: Molten i a b a -> Molten i a b (Molten i a b a) #

extend :: (Molten i a b a -> b) -> Molten i a b a -> Molten i a b b #

((~) * a b, Conjoined p) => Comonad (Pretext p a b) 

Methods

extract :: Pretext p a b a -> a #

duplicate :: Pretext p a b a -> Pretext p a b (Pretext p a b a) #

extend :: (Pretext p a b a -> b) -> Pretext p a b a -> Pretext p a b b #

((~) * a b, Conjoined p) => Comonad (PretextT p g a b) 

Methods

extract :: PretextT p g a b a -> a #

duplicate :: PretextT p g a b a -> PretextT p g a b (PretextT p g a b a) #

extend :: (PretextT p g a b a -> b) -> PretextT p g a b a -> PretextT p g a b b #

class Comonad w => ComonadStore s w | w -> s where #

Minimal complete definition

pos, peek

Instances

ComonadStore s w => ComonadStore s (Cofree w) 

Methods

pos :: Cofree w a -> s #

peek :: s -> Cofree w a -> a #

peeks :: (s -> s) -> Cofree w a -> a #

seek :: s -> Cofree w a -> Cofree w a #

seeks :: (s -> s) -> Cofree w a -> Cofree w a #

experiment :: Functor f => (s -> f s) -> Cofree w a -> f a #

(ComonadStore s w, Monoid m) => ComonadStore s (TracedT m w) 

Methods

pos :: TracedT m w a -> s #

peek :: s -> TracedT m w a -> a #

peeks :: (s -> s) -> TracedT m w a -> a #

seek :: s -> TracedT m w a -> TracedT m w a #

seeks :: (s -> s) -> TracedT m w a -> TracedT m w a #

experiment :: Functor f => (s -> f s) -> TracedT m w a -> f a #

Comonad w => ComonadStore s (StoreT s w) 

Methods

pos :: StoreT s w a -> s #

peek :: s -> StoreT s w a -> a #

peeks :: (s -> s) -> StoreT s w a -> a #

seek :: s -> StoreT s w a -> StoreT s w a #

seeks :: (s -> s) -> StoreT s w a -> StoreT s w a #

experiment :: Functor f => (s -> f s) -> StoreT s w a -> f a #

ComonadStore s w => ComonadStore s (IdentityT * w) 

Methods

pos :: IdentityT * w a -> s #

peek :: s -> IdentityT * w a -> a #

peeks :: (s -> s) -> IdentityT * w a -> a #

seek :: s -> IdentityT * w a -> IdentityT * w a #

seeks :: (s -> s) -> IdentityT * w a -> IdentityT * w a #

experiment :: Functor f => (s -> f s) -> IdentityT * w a -> f a #

ComonadStore s w => ComonadStore s (EnvT e w) 

Methods

pos :: EnvT e w a -> s #

peek :: s -> EnvT e w a -> a #

peeks :: (s -> s) -> EnvT e w a -> a #

seek :: s -> EnvT e w a -> EnvT e w a #

seeks :: (s -> s) -> EnvT e w a -> EnvT e w a #

experiment :: Functor f => (s -> f s) -> EnvT e w a -> f a #

(~) * a b => ComonadStore a (Context a b) 

Methods

pos :: Context a b a -> a #

peek :: a -> Context a b a -> a #

peeks :: (a -> a) -> Context a b a -> a #

seek :: a -> Context a b a -> Context a b a #

seeks :: (a -> a) -> Context a b a -> Context a b a #

experiment :: Functor f => (a -> f a) -> Context a b a -> f a #

((~) * a b, Conjoined p) => ComonadStore a (Pretext p a b) 

Methods

pos :: Pretext p a b a -> a #

peek :: a -> Pretext p a b a -> a #

peeks :: (a -> a) -> Pretext p a b a -> a #

seek :: a -> Pretext p a b a -> Pretext p a b a #

seeks :: (a -> a) -> Pretext p a b a -> Pretext p a b a #

experiment :: Functor f => (a -> f a) -> Pretext p a b a -> f a #

((~) * a b, Conjoined p) => ComonadStore a (PretextT p g a b) 

Methods

pos :: PretextT p g a b a -> a #

peek :: a -> PretextT p g a b a -> a #

peeks :: (a -> a) -> PretextT p g a b a -> a #

seek :: a -> PretextT p g a b a -> PretextT p g a b a #

seeks :: (a -> a) -> PretextT p g a b a -> PretextT p g a b a #

experiment :: Functor f => (a -> f a) -> PretextT p g a b a -> f a #

Shape f => ComonadStore (f Int) (Focused f) # 

Methods

pos :: Focused f a -> f Int #

peek :: f Int -> Focused f a -> a #

peeks :: (f Int -> f Int) -> Focused f a -> a #

seek :: f Int -> Focused f a -> Focused f a #

seeks :: (f Int -> f Int) -> Focused f a -> Focused f a #

experiment :: Functor f => (f Int -> f (f Int)) -> Focused f a -> f a #

Stencils

data Stencil f a Source #

Stencils are used to fold over neighbouring array sites. To construct a stencil use mkStencil, mkStencilUnboxed. For static sized stencils you can use the quasiquoter stencil.

To use a stencil you can use stencilSum or use the Foldable and FoldableWithIndex instances.

Instances

Functor (Stencil f) Source # 

Methods

fmap :: (a -> b) -> Stencil f a -> Stencil f b #

(<$) :: a -> Stencil f b -> Stencil f a #

Foldable (Stencil f) Source # 

Methods

fold :: Monoid m => Stencil f m -> m #

foldMap :: Monoid m => (a -> m) -> Stencil f a -> m #

foldr :: (a -> b -> b) -> b -> Stencil f a -> b #

foldr' :: (a -> b -> b) -> b -> Stencil f a -> b #

foldl :: (b -> a -> b) -> b -> Stencil f a -> b #

foldl' :: (b -> a -> b) -> b -> Stencil f a -> b #

foldr1 :: (a -> a -> a) -> Stencil f a -> a #

foldl1 :: (a -> a -> a) -> Stencil f a -> a #

toList :: Stencil f a -> [a] #

null :: Stencil f a -> Bool #

length :: Stencil f a -> Int #

elem :: Eq a => a -> Stencil f a -> Bool #

maximum :: Ord a => Stencil f a -> a #

minimum :: Ord a => Stencil f a -> a #

sum :: Num a => Stencil f a -> a #

product :: Num a => Stencil f a -> a #

FoldableWithIndex (f Int) (Stencil f) Source # 

Methods

ifoldMap :: Monoid m => (f Int -> a -> m) -> Stencil f a -> m #

ifolded :: (Indexable (f Int) p, Contravariant f, Applicative f) => p a (f a) -> Stencil f a -> f (Stencil f a) #

ifoldr :: (f Int -> a -> b -> b) -> b -> Stencil f a -> b #

ifoldl :: (f Int -> b -> a -> b) -> b -> Stencil f a -> b #

ifoldr' :: (f Int -> a -> b -> b) -> b -> Stencil f a -> b #

ifoldl' :: (f Int -> b -> a -> b) -> b -> Stencil f a -> b #

(Show1 f, Show a) => Show (Stencil f a) Source # 

Methods

showsPrec :: Int -> Stencil f a -> ShowS #

show :: Stencil f a -> String #

showList :: [Stencil f a] -> ShowS #

Constructing stencils

stencil :: QuasiQuoter Source #

QuasiQuoter for producing a static stencil definition. This is a versatile parser for 1D, 2D and 3D stencils. The parsing is similar to dense but stencil also supports _, which means ignore this element. Also, stencils should have an odd length in all dimensions so there is always a center element (which is used as zero).

Examples

  • 1D stencils are of the form
[stencil| 5 -3 1 -3 5 |] :: Num a => Stencil V1 a
  • 2D stencils are of the form
myStencil2 :: Num a => Stencil V2 a
myStencil2 = [stencil|
  0 1 0
  1 0 1
  0 1 0
|]
  • 3D stencils have gaps between planes.
myStencil3 :: Fractional a => Stencil V3 a
myStencil3 :: [stencil|
  1/20 3/10 1/20
  3/10  1   3/10
  1/20 3/10 1/20

  3/10  1   3/10
   1    _    1
  3/10  1   3/10

  1/20 3/10 1/20
  3/10  1   3/10
  1/20 3/10 1/20
|]

Variables can also be used

myStencil2' :: a -> a -> a -> Stencil V2 a
myStencil2' a b c = [stencil|
  c b c
  b a b
  c b c
|]

mkStencil :: [(f Int, a)] -> Stencil f a Source #

Make a stencil folding over a list.

If the list is staticlly known this should expand at compile time via rewrite rules, similar to makeStencilTH but less reliable. If that does not happen the resulting could be slow. If the list is not know at compile time, mkStencilUnboxed can be signifcantly faster (but isn't subject expending via rewrite rules).

mkStencilTH :: (ShapeLift f, Lift a) => [(f Int, a)] -> Q Exp Source #

Construct a Stencil by unrolling the list at compile time. For example

ifoldr f b $(mkStencilTH [(V1 (-1), 5), (V1 0, 3), (V1 1, 5)])

will be get turned into

f (V1 (-1)) 5 (f (V1 0) 3 (f (V1 1) 5 b))

at compile time. Since there are no loops and all target indexes are known at compile time, this can lead to more optimisations and faster execution times. This can lead to around a 2x speed up compared to folding over unboxed vectors.

myStencil = $(mkStencilTH (as :: [(f Int, a)])) :: Stencil f a

Using stencils

stencilSum :: (Shape f, Num a) => Boundary -> Stencil f a -> Focused f a -> a Source #

Sum the elements around a Focused using a Boundary condition and a Stencil.

This is often used in conjunction with extendFocus.

Common shapes

newtype V1 a :: * -> * #

A 1-dimensional vector

>>> pure 1 :: V1 Int
V1 1
>>> V1 2 + V1 3
V1 5
>>> V1 2 * V1 3
V1 6
>>> sum (V1 2)
2

Constructors

V1 a 

Instances

Monad V1 

Methods

(>>=) :: V1 a -> (a -> V1 b) -> V1 b #

(>>) :: V1 a -> V1 b -> V1 b #

return :: a -> V1 a #

fail :: String -> V1 a #

Functor V1 

Methods

fmap :: (a -> b) -> V1 a -> V1 b #

(<$) :: a -> V1 b -> V1 a #

MonadFix V1 

Methods

mfix :: (a -> V1 a) -> V1 a #

Applicative V1 

Methods

pure :: a -> V1 a #

(<*>) :: V1 (a -> b) -> V1 a -> V1 b #

(*>) :: V1 a -> V1 b -> V1 b #

(<*) :: V1 a -> V1 b -> V1 a #

Foldable V1 

Methods

fold :: Monoid m => V1 m -> m #

foldMap :: Monoid m => (a -> m) -> V1 a -> m #

foldr :: (a -> b -> b) -> b -> V1 a -> b #

foldr' :: (a -> b -> b) -> b -> V1 a -> b #

foldl :: (b -> a -> b) -> b -> V1 a -> b #

foldl' :: (b -> a -> b) -> b -> V1 a -> b #

foldr1 :: (a -> a -> a) -> V1 a -> a #

foldl1 :: (a -> a -> a) -> V1 a -> a #

toList :: V1 a -> [a] #

null :: V1 a -> Bool #

length :: V1 a -> Int #

elem :: Eq a => a -> V1 a -> Bool #

maximum :: Ord a => V1 a -> a #

minimum :: Ord a => V1 a -> a #

sum :: Num a => V1 a -> a #

product :: Num a => V1 a -> a #

Traversable V1 

Methods

traverse :: Applicative f => (a -> f b) -> V1 a -> f (V1 b) #

sequenceA :: Applicative f => V1 (f a) -> f (V1 a) #

mapM :: Monad m => (a -> m b) -> V1 a -> m (V1 b) #

sequence :: Monad m => V1 (m a) -> m (V1 a) #

Generic1 V1 

Associated Types

type Rep1 (V1 :: * -> *) :: * -> * #

Methods

from1 :: V1 a -> Rep1 V1 a #

to1 :: Rep1 V1 a -> V1 a #

Distributive V1 

Methods

distribute :: Functor f => f (V1 a) -> V1 (f a) #

collect :: Functor f => (a -> V1 b) -> f a -> V1 (f b) #

distributeM :: Monad m => m (V1 a) -> V1 (m a) #

collectM :: Monad m => (a -> V1 b) -> m a -> V1 (m b) #

Representable V1 

Associated Types

type Rep (V1 :: * -> *) :: * #

Methods

tabulate :: (Rep V1 -> a) -> V1 a #

index :: V1 a -> Rep V1 -> a #

Eq1 V1 

Methods

liftEq :: (a -> b -> Bool) -> V1 a -> V1 b -> Bool #

Ord1 V1 

Methods

liftCompare :: (a -> b -> Ordering) -> V1 a -> V1 b -> Ordering #

Read1 V1 

Methods

liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (V1 a) #

liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [V1 a] #

Show1 V1 

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> V1 a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [V1 a] -> ShowS #

MonadZip V1 

Methods

mzip :: V1 a -> V1 b -> V1 (a, b) #

mzipWith :: (a -> b -> c) -> V1 a -> V1 b -> V1 c #

munzip :: V1 (a, b) -> (V1 a, V1 b) #

Serial1 V1 

Methods

serializeWith :: MonadPut m => (a -> m ()) -> V1 a -> m () #

deserializeWith :: MonadGet m => m a -> m (V1 a) #

Traversable1 V1 

Methods

traverse1 :: Apply f => (a -> f b) -> V1 a -> f (V1 b) #

sequence1 :: Apply f => V1 (f b) -> f (V1 b) #

R1 V1 

Methods

_x :: Functor f => (a -> f a) -> V1 a -> f (V1 a) #

Metric V1 

Methods

dot :: Num a => V1 a -> V1 a -> a #

quadrance :: Num a => V1 a -> a #

qd :: Num a => V1 a -> V1 a -> a #

distance :: Floating a => V1 a -> V1 a -> a #

norm :: Floating a => V1 a -> a #

signorm :: Floating a => V1 a -> V1 a #

Additive V1 

Methods

zero :: Num a => V1 a #

(^+^) :: Num a => V1 a -> V1 a -> V1 a #

(^-^) :: Num a => V1 a -> V1 a -> V1 a #

lerp :: Num a => a -> V1 a -> V1 a -> V1 a #

liftU2 :: (a -> a -> a) -> V1 a -> V1 a -> V1 a #

liftI2 :: (a -> b -> c) -> V1 a -> V1 b -> V1 c #

Apply V1 

Methods

(<.>) :: V1 (a -> b) -> V1 a -> V1 b #

(.>) :: V1 a -> V1 b -> V1 b #

(<.) :: V1 a -> V1 b -> V1 a #

Bind V1 

Methods

(>>-) :: V1 a -> (a -> V1 b) -> V1 b #

join :: V1 (V1 a) -> V1 a #

Foldable1 V1 

Methods

fold1 :: Semigroup m => V1 m -> m #

foldMap1 :: Semigroup m => (a -> m) -> V1 a -> m #

Shape V1 Source # 
ShapeLift V1 Source # 

Methods

liftShape :: Lift a => V1 a -> Q Exp Source #

liftShape' :: Lift a => V1 a -> Q Exp Source #

Unbox a => Vector Vector (V1 a) 

Methods

basicUnsafeFreeze :: PrimMonad m => Mutable Vector (PrimState m) (V1 a) -> m (Vector (V1 a)) #

basicUnsafeThaw :: PrimMonad m => Vector (V1 a) -> m (Mutable Vector (PrimState m) (V1 a)) #

basicLength :: Vector (V1 a) -> Int #

basicUnsafeSlice :: Int -> Int -> Vector (V1 a) -> Vector (V1 a) #

basicUnsafeIndexM :: Monad m => Vector (V1 a) -> Int -> m (V1 a) #

basicUnsafeCopy :: PrimMonad m => Mutable Vector (PrimState m) (V1 a) -> Vector (V1 a) -> m () #

elemseq :: Vector (V1 a) -> V1 a -> b -> b #

Unbox a => MVector MVector (V1 a) 

Methods

basicLength :: MVector s (V1 a) -> Int #

basicUnsafeSlice :: Int -> Int -> MVector s (V1 a) -> MVector s (V1 a) #

basicOverlaps :: MVector s (V1 a) -> MVector s (V1 a) -> Bool #

basicUnsafeNew :: PrimMonad m => Int -> m (MVector (PrimState m) (V1 a)) #

basicInitialize :: PrimMonad m => MVector (PrimState m) (V1 a) -> m () #

basicUnsafeReplicate :: PrimMonad m => Int -> V1 a -> m (MVector (PrimState m) (V1 a)) #

basicUnsafeRead :: PrimMonad m => MVector (PrimState m) (V1 a) -> Int -> m (V1 a) #

basicUnsafeWrite :: PrimMonad m => MVector (PrimState m) (V1 a) -> Int -> V1 a -> m () #

basicClear :: PrimMonad m => MVector (PrimState m) (V1 a) -> m () #

basicSet :: PrimMonad m => MVector (PrimState m) (V1 a) -> V1 a -> m () #

basicUnsafeCopy :: PrimMonad m => MVector (PrimState m) (V1 a) -> MVector (PrimState m) (V1 a) -> m () #

basicUnsafeMove :: PrimMonad m => MVector (PrimState m) (V1 a) -> MVector (PrimState m) (V1 a) -> m () #

basicUnsafeGrow :: PrimMonad m => MVector (PrimState m) (V1 a) -> Int -> m (MVector (PrimState m) (V1 a)) #

(~) * i Int => HasLayout V1 (V1 i) Source # 

Methods

layout :: Lens' (V1 i) (Layout V1) Source #

Bounded a => Bounded (V1 a) 

Methods

minBound :: V1 a #

maxBound :: V1 a #

Eq a => Eq (V1 a) 

Methods

(==) :: V1 a -> V1 a -> Bool #

(/=) :: V1 a -> V1 a -> Bool #

Floating a => Floating (V1 a) 

Methods

pi :: V1 a #

exp :: V1 a -> V1 a #

log :: V1 a -> V1 a #

sqrt :: V1 a -> V1 a #

(**) :: V1 a -> V1 a -> V1 a #

logBase :: V1 a -> V1 a -> V1 a #

sin :: V1 a -> V1 a #

cos :: V1 a -> V1 a #

tan :: V1 a -> V1 a #

asin :: V1 a -> V1 a #

acos :: V1 a -> V1 a #

atan :: V1 a -> V1 a #

sinh :: V1 a -> V1 a #

cosh :: V1 a -> V1 a #

tanh :: V1 a -> V1 a #

asinh :: V1 a -> V1 a #

acosh :: V1 a -> V1 a #

atanh :: V1 a -> V1 a #

log1p :: V1 a -> V1 a #

expm1 :: V1 a -> V1 a #

log1pexp :: V1 a -> V1 a #

log1mexp :: V1 a -> V1 a #

Fractional a => Fractional (V1 a) 

Methods

(/) :: V1 a -> V1 a -> V1 a #

recip :: V1 a -> V1 a #

fromRational :: Rational -> V1 a #

Data a => Data (V1 a) 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> V1 a -> c (V1 a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (V1 a) #

toConstr :: V1 a -> Constr #

dataTypeOf :: V1 a -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (V1 a)) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (V1 a)) #

gmapT :: (forall b. Data b => b -> b) -> V1 a -> V1 a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> V1 a -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> V1 a -> r #

gmapQ :: (forall d. Data d => d -> u) -> V1 a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> V1 a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> V1 a -> m (V1 a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> V1 a -> m (V1 a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> V1 a -> m (V1 a) #

Num a => Num (V1 a) 

Methods

(+) :: V1 a -> V1 a -> V1 a #

(-) :: V1 a -> V1 a -> V1 a #

(*) :: V1 a -> V1 a -> V1 a #

negate :: V1 a -> V1 a #

abs :: V1 a -> V1 a #

signum :: V1 a -> V1 a #

fromInteger :: Integer -> V1 a #

Ord a => Ord (V1 a) 

Methods

compare :: V1 a -> V1 a -> Ordering #

(<) :: V1 a -> V1 a -> Bool #

(<=) :: V1 a -> V1 a -> Bool #

(>) :: V1 a -> V1 a -> Bool #

(>=) :: V1 a -> V1 a -> Bool #

max :: V1 a -> V1 a -> V1 a #

min :: V1 a -> V1 a -> V1 a #

Read a => Read (V1 a) 
Show a => Show (V1 a) 

Methods

showsPrec :: Int -> V1 a -> ShowS #

show :: V1 a -> String #

showList :: [V1 a] -> ShowS #

Ix a => Ix (V1 a) 

Methods

range :: (V1 a, V1 a) -> [V1 a] #

index :: (V1 a, V1 a) -> V1 a -> Int #

unsafeIndex :: (V1 a, V1 a) -> V1 a -> Int

inRange :: (V1 a, V1 a) -> V1 a -> Bool #

rangeSize :: (V1 a, V1 a) -> Int #

unsafeRangeSize :: (V1 a, V1 a) -> Int

Generic (V1 a) 

Associated Types

type Rep (V1 a) :: * -> * #

Methods

from :: V1 a -> Rep (V1 a) x #

to :: Rep (V1 a) x -> V1 a #

Storable a => Storable (V1 a) 

Methods

sizeOf :: V1 a -> Int #

alignment :: V1 a -> Int #

peekElemOff :: Ptr (V1 a) -> Int -> IO (V1 a) #

pokeElemOff :: Ptr (V1 a) -> Int -> V1 a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (V1 a) #

pokeByteOff :: Ptr b -> Int -> V1 a -> IO () #

peek :: Ptr (V1 a) -> IO (V1 a) #

poke :: Ptr (V1 a) -> V1 a -> IO () #

Binary a => Binary (V1 a) 

Methods

put :: V1 a -> Put #

get :: Get (V1 a) #

putList :: [V1 a] -> Put #

Serial a => Serial (V1 a) 

Methods

serialize :: MonadPut m => V1 a -> m () #

deserialize :: MonadGet m => m (V1 a) #

Serialize a => Serialize (V1 a) 

Methods

put :: Putter (V1 a) #

get :: Get (V1 a) #

NFData a => NFData (V1 a) 

Methods

rnf :: V1 a -> () #

Hashable a => Hashable (V1 a) 

Methods

hashWithSalt :: Int -> V1 a -> Int #

hash :: V1 a -> Int #

Unbox a => Unbox (V1 a) 
Ixed (V1 a) 

Methods

ix :: Index (V1 a) -> Traversal' (V1 a) (IxValue (V1 a)) #

Epsilon a => Epsilon (V1 a) 

Methods

nearZero :: V1 a -> Bool #

FunctorWithIndex (E V1) V1 

Methods

imap :: (E V1 -> a -> b) -> V1 a -> V1 b #

imapped :: (Indexable (E V1) p, Settable f) => p a (f b) -> V1 a -> f (V1 b) #

FoldableWithIndex (E V1) V1 

Methods

ifoldMap :: Monoid m => (E V1 -> a -> m) -> V1 a -> m #

ifolded :: (Indexable (E V1) p, Contravariant f, Applicative f) => p a (f a) -> V1 a -> f (V1 a) #

ifoldr :: (E V1 -> a -> b -> b) -> b -> V1 a -> b #

ifoldl :: (E V1 -> b -> a -> b) -> b -> V1 a -> b #

ifoldr' :: (E V1 -> a -> b -> b) -> b -> V1 a -> b #

ifoldl' :: (E V1 -> b -> a -> b) -> b -> V1 a -> b #

TraversableWithIndex (E V1) V1 

Methods

itraverse :: Applicative f => (E V1 -> a -> f b) -> V1 a -> f (V1 b) #

itraversed :: (Indexable (E V1) p, Applicative f) => p a (f b) -> V1 a -> f (V1 b) #

Each (V1 a) (V1 b) a b 

Methods

each :: Traversal (V1 a) (V1 b) a b #

type Rep1 V1 
type Rep1 V1 = D1 (MetaData "V1" "Linear.V1" "linear-1.20.5-7wYpWNZANRhKtNZ0kWxto6" True) (C1 (MetaCons "V1" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) Par1))
type Rep V1 
type Rep V1 = E V1
data MVector s (V1 a) 
data MVector s (V1 a) = MV_V1 (MVector s a)
type Rep (V1 a) 
type Rep (V1 a) = D1 (MetaData "V1" "Linear.V1" "linear-1.20.5-7wYpWNZANRhKtNZ0kWxto6" True) (C1 (MetaCons "V1" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a)))
data Vector (V1 a) 
data Vector (V1 a) = V_V1 (Vector a)
type Index (V1 a) 
type Index (V1 a) = E V1
type IxValue (V1 a) 
type IxValue (V1 a) = a

data V2 a :: * -> * #

A 2-dimensional vector

>>> pure 1 :: V2 Int
V2 1 1
>>> V2 1 2 + V2 3 4
V2 4 6
>>> V2 1 2 * V2 3 4
V2 3 8
>>> sum (V2 1 2)
3

Constructors

V2 ~a ~a 

Instances

Monad V2 

Methods

(>>=) :: V2 a -> (a -> V2 b) -> V2 b #

(>>) :: V2 a -> V2 b -> V2 b #

return :: a -> V2 a #

fail :: String -> V2 a #

Functor V2 

Methods

fmap :: (a -> b) -> V2 a -> V2 b #

(<$) :: a -> V2 b -> V2 a #

MonadFix V2 

Methods

mfix :: (a -> V2 a) -> V2 a #

Applicative V2 

Methods

pure :: a -> V2 a #

(<*>) :: V2 (a -> b) -> V2 a -> V2 b #

(*>) :: V2 a -> V2 b -> V2 b #

(<*) :: V2 a -> V2 b -> V2 a #

Foldable V2 

Methods

fold :: Monoid m => V2 m -> m #

foldMap :: Monoid m => (a -> m) -> V2 a -> m #

foldr :: (a -> b -> b) -> b -> V2 a -> b #

foldr' :: (a -> b -> b) -> b -> V2 a -> b #

foldl :: (b -> a -> b) -> b -> V2 a -> b #

foldl' :: (b -> a -> b) -> b -> V2 a -> b #

foldr1 :: (a -> a -> a) -> V2 a -> a #

foldl1 :: (a -> a -> a) -> V2 a -> a #

toList :: V2 a -> [a] #

null :: V2 a -> Bool #

length :: V2 a -> Int #

elem :: Eq a => a -> V2 a -> Bool #

maximum :: Ord a => V2 a -> a #

minimum :: Ord a => V2 a -> a #

sum :: Num a => V2 a -> a #

product :: Num a => V2 a -> a #

Traversable V2 

Methods

traverse :: Applicative f => (a -> f b) -> V2 a -> f (V2 b) #

sequenceA :: Applicative f => V2 (f a) -> f (V2 a) #

mapM :: Monad m => (a -> m b) -> V2 a -> m (V2 b) #

sequence :: Monad m => V2 (m a) -> m (V2 a) #

Generic1 V2 

Associated Types

type Rep1 (V2 :: * -> *) :: * -> * #

Methods

from1 :: V2 a -> Rep1 V2 a #

to1 :: Rep1 V2 a -> V2 a #

Distributive V2 

Methods

distribute :: Functor f => f (V2 a) -> V2 (f a) #

collect :: Functor f => (a -> V2 b) -> f a -> V2 (f b) #

distributeM :: Monad m => m (V2 a) -> V2 (m a) #

collectM :: Monad m => (a -> V2 b) -> m a -> V2 (m b) #

Representable V2 

Associated Types

type Rep (V2 :: * -> *) :: * #

Methods

tabulate :: (Rep V2 -> a) -> V2 a #

index :: V2 a -> Rep V2 -> a #

Eq1 V2 

Methods

liftEq :: (a -> b -> Bool) -> V2 a -> V2 b -> Bool #

Ord1 V2 

Methods

liftCompare :: (a -> b -> Ordering) -> V2 a -> V2 b -> Ordering #

Read1 V2 

Methods

liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (V2 a) #

liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [V2 a] #

Show1 V2 

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> V2 a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [V2 a] -> ShowS #

MonadZip V2 

Methods

mzip :: V2 a -> V2 b -> V2 (a, b) #

mzipWith :: (a -> b -> c) -> V2 a -> V2 b -> V2 c #

munzip :: V2 (a, b) -> (V2 a, V2 b) #

Serial1 V2 

Methods

serializeWith :: MonadPut m => (a -> m ()) -> V2 a -> m () #

deserializeWith :: MonadGet m => m a -> m (V2 a) #

Traversable1 V2 

Methods

traverse1 :: Apply f => (a -> f b) -> V2 a -> f (V2 b) #

sequence1 :: Apply f => V2 (f b) -> f (V2 b) #

R2 V2 

Methods

_y :: Functor f => (a -> f a) -> V2 a -> f (V2 a) #

_xy :: Functor f => (V2 a -> f (V2 a)) -> V2 a -> f (V2 a) #

R1 V2 

Methods

_x :: Functor f => (a -> f a) -> V2 a -> f (V2 a) #

Metric V2 

Methods

dot :: Num a => V2 a -> V2 a -> a #

quadrance :: Num a => V2 a -> a #

qd :: Num a => V2 a -> V2 a -> a #

distance :: Floating a => V2 a -> V2 a -> a #

norm :: Floating a => V2 a -> a #

signorm :: Floating a => V2 a -> V2 a #

Additive V2 

Methods

zero :: Num a => V2 a #

(^+^) :: Num a => V2 a -> V2 a -> V2 a #

(^-^) :: Num a => V2 a -> V2 a -> V2 a #

lerp :: Num a => a -> V2 a -> V2 a -> V2 a #

liftU2 :: (a -> a -> a) -> V2 a -> V2 a -> V2 a #

liftI2 :: (a -> b -> c) -> V2 a -> V2 b -> V2 c #

Apply V2 

Methods

(<.>) :: V2 (a -> b) -> V2 a -> V2 b #

(.>) :: V2 a -> V2 b -> V2 b #

(<.) :: V2 a -> V2 b -> V2 a #

Bind V2 

Methods

(>>-) :: V2 a -> (a -> V2 b) -> V2 b #

join :: V2 (V2 a) -> V2 a #

Foldable1 V2 

Methods

fold1 :: Semigroup m => V2 m -> m #

foldMap1 :: Semigroup m => (a -> m) -> V2 a -> m #

Shape V2 Source # 
ShapeLift V2 Source # 

Methods

liftShape :: Lift a => V2 a -> Q Exp Source #

liftShape' :: Lift a => V2 a -> Q Exp Source #

Unbox a => Vector Vector (V2 a) 

Methods

basicUnsafeFreeze :: PrimMonad m => Mutable Vector (PrimState m) (V2 a) -> m (Vector (V2 a)) #

basicUnsafeThaw :: PrimMonad m => Vector (V2 a) -> m (Mutable Vector (PrimState m) (V2 a)) #

basicLength :: Vector (V2 a) -> Int #

basicUnsafeSlice :: Int -> Int -> Vector (V2 a) -> Vector (V2 a) #

basicUnsafeIndexM :: Monad m => Vector (V2 a) -> Int -> m (V2 a) #

basicUnsafeCopy :: PrimMonad m => Mutable Vector (PrimState m) (V2 a) -> Vector (V2 a) -> m () #

elemseq :: Vector (V2 a) -> V2 a -> b -> b #

Unbox a => MVector MVector (V2 a) 

Methods

basicLength :: MVector s (V2 a) -> Int #

basicUnsafeSlice :: Int -> Int -> MVector s (V2 a) -> MVector s (V2 a) #

basicOverlaps :: MVector s (V2 a) -> MVector s (V2 a) -> Bool #

basicUnsafeNew :: PrimMonad m => Int -> m (MVector (PrimState m) (V2 a)) #

basicInitialize :: PrimMonad m => MVector (PrimState m) (V2 a) -> m () #

basicUnsafeReplicate :: PrimMonad m => Int -> V2 a -> m (MVector (PrimState m) (V2 a)) #

basicUnsafeRead :: PrimMonad m => MVector (PrimState m) (V2 a) -> Int -> m (V2 a) #

basicUnsafeWrite :: PrimMonad m => MVector (PrimState m) (V2 a) -> Int -> V2 a -> m () #

basicClear :: PrimMonad m => MVector (PrimState m) (V2 a) -> m () #

basicSet :: PrimMonad m => MVector (PrimState m) (V2 a) -> V2 a -> m () #

basicUnsafeCopy :: PrimMonad m => MVector (PrimState m) (V2 a) -> MVector (PrimState m) (V2 a) -> m () #

basicUnsafeMove :: PrimMonad m => MVector (PrimState m) (V2 a) -> MVector (PrimState m) (V2 a) -> m () #

basicUnsafeGrow :: PrimMonad m => MVector (PrimState m) (V2 a) -> Int -> m (MVector (PrimState m) (V2 a)) #

(~) * i Int => HasLayout V2 (V2 i) Source # 

Methods

layout :: Lens' (V2 i) (Layout V2) Source #

Bounded a => Bounded (V2 a) 

Methods

minBound :: V2 a #

maxBound :: V2 a #

Eq a => Eq (V2 a) 

Methods

(==) :: V2 a -> V2 a -> Bool #

(/=) :: V2 a -> V2 a -> Bool #

Floating a => Floating (V2 a) 

Methods

pi :: V2 a #

exp :: V2 a -> V2 a #

log :: V2 a -> V2 a #

sqrt :: V2 a -> V2 a #

(**) :: V2 a -> V2 a -> V2 a #

logBase :: V2 a -> V2 a -> V2 a #

sin :: V2 a -> V2 a #

cos :: V2 a -> V2 a #

tan :: V2 a -> V2 a #

asin :: V2 a -> V2 a #

acos :: V2 a -> V2 a #

atan :: V2 a -> V2 a #

sinh :: V2 a -> V2 a #

cosh :: V2 a -> V2 a #

tanh :: V2 a -> V2 a #

asinh :: V2 a -> V2 a #

acosh :: V2 a -> V2 a #

atanh :: V2 a -> V2 a #

log1p :: V2 a -> V2 a #

expm1 :: V2 a -> V2 a #

log1pexp :: V2 a -> V2 a #

log1mexp :: V2 a -> V2 a #

Fractional a => Fractional (V2 a) 

Methods

(/) :: V2 a -> V2 a -> V2 a #

recip :: V2 a -> V2 a #

fromRational :: Rational -> V2 a #

Data a => Data (V2 a) 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> V2 a -> c (V2 a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (V2 a) #

toConstr :: V2 a -> Constr #

dataTypeOf :: V2 a -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (V2 a)) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (V2 a)) #

gmapT :: (forall b. Data b => b -> b) -> V2 a -> V2 a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> V2 a -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> V2 a -> r #

gmapQ :: (forall d. Data d => d -> u) -> V2 a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> V2 a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> V2 a -> m (V2 a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> V2 a -> m (V2 a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> V2 a -> m (V2 a) #

Num a => Num (V2 a) 

Methods

(+) :: V2 a -> V2 a -> V2 a #

(-) :: V2 a -> V2 a -> V2 a #

(*) :: V2 a -> V2 a -> V2 a #

negate :: V2 a -> V2 a #

abs :: V2 a -> V2 a #

signum :: V2 a -> V2 a #

fromInteger :: Integer -> V2 a #

Ord a => Ord (V2 a) 

Methods

compare :: V2 a -> V2 a -> Ordering #

(<) :: V2 a -> V2 a -> Bool #

(<=) :: V2 a -> V2 a -> Bool #

(>) :: V2 a -> V2 a -> Bool #

(>=) :: V2 a -> V2 a -> Bool #

max :: V2 a -> V2 a -> V2 a #

min :: V2 a -> V2 a -> V2 a #

Read a => Read (V2 a) 
Show a => Show (V2 a) 

Methods

showsPrec :: Int -> V2 a -> ShowS #

show :: V2 a -> String #

showList :: [V2 a] -> ShowS #

Ix a => Ix (V2 a) 

Methods

range :: (V2 a, V2 a) -> [V2 a] #

index :: (V2 a, V2 a) -> V2 a -> Int #

unsafeIndex :: (V2 a, V2 a) -> V2 a -> Int

inRange :: (V2 a, V2 a) -> V2 a -> Bool #

rangeSize :: (V2 a, V2 a) -> Int #

unsafeRangeSize :: (V2 a, V2 a) -> Int

Generic (V2 a) 

Associated Types

type Rep (V2 a) :: * -> * #

Methods

from :: V2 a -> Rep (V2 a) x #

to :: Rep (V2 a) x -> V2 a #

Storable a => Storable (V2 a) 

Methods

sizeOf :: V2 a -> Int #

alignment :: V2 a -> Int #

peekElemOff :: Ptr (V2 a) -> Int -> IO (V2 a) #

pokeElemOff :: Ptr (V2 a) -> Int -> V2 a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (V2 a) #

pokeByteOff :: Ptr b -> Int -> V2 a -> IO () #

peek :: Ptr (V2 a) -> IO (V2 a) #

poke :: Ptr (V2 a) -> V2 a -> IO () #

Binary a => Binary (V2 a) 

Methods

put :: V2 a -> Put #

get :: Get (V2 a) #

putList :: [V2 a] -> Put #

Serial a => Serial (V2 a) 

Methods

serialize :: MonadPut m => V2 a -> m () #

deserialize :: MonadGet m => m (V2 a) #

Serialize a => Serialize (V2 a) 

Methods

put :: Putter (V2 a) #

get :: Get (V2 a) #

NFData a => NFData (V2 a) 

Methods

rnf :: V2 a -> () #

Hashable a => Hashable (V2 a) 

Methods

hashWithSalt :: Int -> V2 a -> Int #

hash :: V2 a -> Int #

Unbox a => Unbox (V2 a) 
Ixed (V2 a) 

Methods

ix :: Index (V2 a) -> Traversal' (V2 a) (IxValue (V2 a)) #

Epsilon a => Epsilon (V2 a) 

Methods

nearZero :: V2 a -> Bool #

FunctorWithIndex (E V2) V2 

Methods

imap :: (E V2 -> a -> b) -> V2 a -> V2 b #

imapped :: (Indexable (E V2) p, Settable f) => p a (f b) -> V2 a -> f (V2 b) #

FoldableWithIndex (E V2) V2 

Methods

ifoldMap :: Monoid m => (E V2 -> a -> m) -> V2 a -> m #

ifolded :: (Indexable (E V2) p, Contravariant f, Applicative f) => p a (f a) -> V2 a -> f (V2 a) #

ifoldr :: (E V2 -> a -> b -> b) -> b -> V2 a -> b #

ifoldl :: (E V2 -> b -> a -> b) -> b -> V2 a -> b #

ifoldr' :: (E V2 -> a -> b -> b) -> b -> V2 a -> b #

ifoldl' :: (E V2 -> b -> a -> b) -> b -> V2 a -> b #

TraversableWithIndex (E V2) V2 

Methods

itraverse :: Applicative f => (E V2 -> a -> f b) -> V2 a -> f (V2 b) #

itraversed :: (Indexable (E V2) p, Applicative f) => p a (f b) -> V2 a -> f (V2 b) #

Each (V2 a) (V2 b) a b 

Methods

each :: Traversal (V2 a) (V2 b) a b #

type Rep1 V2 
type Rep V2 
type Rep V2 = E V2
data MVector s (V2 a) 
data MVector s (V2 a) = MV_V2 ~Int ~(MVector s a)
type Rep (V2 a) 
data Vector (V2 a) 
data Vector (V2 a) = V_V2 ~Int ~(Vector a)
type Index (V2 a) 
type Index (V2 a) = E V2
type IxValue (V2 a) 
type IxValue (V2 a) = a

data V3 a :: * -> * #

A 3-dimensional vector

Constructors

V3 ~a ~a ~a 

Instances

Monad V3 

Methods

(>>=) :: V3 a -> (a -> V3 b) -> V3 b #

(>>) :: V3 a -> V3 b -> V3 b #

return :: a -> V3 a #

fail :: String -> V3 a #

Functor V3 

Methods

fmap :: (a -> b) -> V3 a -> V3 b #

(<$) :: a -> V3 b -> V3 a #

MonadFix V3 

Methods

mfix :: (a -> V3 a) -> V3 a #

Applicative V3 

Methods

pure :: a -> V3 a #

(<*>) :: V3 (a -> b) -> V3 a -> V3 b #

(*>) :: V3 a -> V3 b -> V3 b #

(<*) :: V3 a -> V3 b -> V3 a #

Foldable V3 

Methods

fold :: Monoid m => V3 m -> m #

foldMap :: Monoid m => (a -> m) -> V3 a -> m #

foldr :: (a -> b -> b) -> b -> V3 a -> b #

foldr' :: (a -> b -> b) -> b -> V3 a -> b #

foldl :: (b -> a -> b) -> b -> V3 a -> b #

foldl' :: (b -> a -> b) -> b -> V3 a -> b #

foldr1 :: (a -> a -> a) -> V3 a -> a #

foldl1 :: (a -> a -> a) -> V3 a -> a #

toList :: V3 a -> [a] #

null :: V3 a -> Bool #

length :: V3 a -> Int #

elem :: Eq a => a -> V3 a -> Bool #

maximum :: Ord a => V3 a -> a #

minimum :: Ord a => V3 a -> a #

sum :: Num a => V3 a -> a #

product :: Num a => V3 a -> a #

Traversable V3 

Methods

traverse :: Applicative f => (a -> f b) -> V3 a -> f (V3 b) #

sequenceA :: Applicative f => V3 (f a) -> f (V3 a) #

mapM :: Monad m => (a -> m b) -> V3 a -> m (V3 b) #

sequence :: Monad m => V3 (m a) -> m (V3 a) #

Generic1 V3 

Associated Types

type Rep1 (V3 :: * -> *) :: * -> * #

Methods

from1 :: V3 a -> Rep1 V3 a #

to1 :: Rep1 V3 a -> V3 a #

Distributive V3 

Methods

distribute :: Functor f => f (V3 a) -> V3 (f a) #

collect :: Functor f => (a -> V3 b) -> f a -> V3 (f b) #

distributeM :: Monad m => m (V3 a) -> V3 (m a) #

collectM :: Monad m => (a -> V3 b) -> m a -> V3 (m b) #

Representable V3 

Associated Types

type Rep (V3 :: * -> *) :: * #

Methods

tabulate :: (Rep V3 -> a) -> V3 a #

index :: V3 a -> Rep V3 -> a #

Eq1 V3 

Methods

liftEq :: (a -> b -> Bool) -> V3 a -> V3 b -> Bool #

Ord1 V3 

Methods

liftCompare :: (a -> b -> Ordering) -> V3 a -> V3 b -> Ordering #

Read1 V3 

Methods

liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (V3 a) #

liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [V3 a] #

Show1 V3 

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> V3 a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [V3 a] -> ShowS #

MonadZip V3 

Methods

mzip :: V3 a -> V3 b -> V3 (a, b) #

mzipWith :: (a -> b -> c) -> V3 a -> V3 b -> V3 c #

munzip :: V3 (a, b) -> (V3 a, V3 b) #

Serial1 V3 

Methods

serializeWith :: MonadPut m => (a -> m ()) -> V3 a -> m () #

deserializeWith :: MonadGet m => m a -> m (V3 a) #

Traversable1 V3 

Methods

traverse1 :: Apply f => (a -> f b) -> V3 a -> f (V3 b) #

sequence1 :: Apply f => V3 (f b) -> f (V3 b) #

R3 V3 

Methods

_z :: Functor f => (a -> f a) -> V3 a -> f (V3 a) #

_xyz :: Functor f => (V3 a -> f (V3 a)) -> V3 a -> f (V3 a) #

R2 V3 

Methods

_y :: Functor f => (a -> f a) -> V3 a -> f (V3 a) #

_xy :: Functor f => (V2 a -> f (V2 a)) -> V3 a -> f (V3 a) #

R1 V3 

Methods

_x :: Functor f => (a -> f a) -> V3 a -> f (V3 a) #

Metric V3 

Methods

dot :: Num a => V3 a -> V3 a -> a #

quadrance :: Num a => V3 a -> a #

qd :: Num a => V3 a -> V3 a -> a #

distance :: Floating a => V3 a -> V3 a -> a #

norm :: Floating a => V3 a -> a #

signorm :: Floating a => V3 a -> V3 a #

Additive V3 

Methods

zero :: Num a => V3 a #

(^+^) :: Num a => V3 a -> V3 a -> V3 a #

(^-^) :: Num a => V3 a -> V3 a -> V3 a #

lerp :: Num a => a -> V3 a -> V3 a -> V3 a #

liftU2 :: (a -> a -> a) -> V3 a -> V3 a -> V3 a #

liftI2 :: (a -> b -> c) -> V3 a -> V3 b -> V3 c #

Apply V3 

Methods

(<.>) :: V3 (a -> b) -> V3 a -> V3 b #

(.>) :: V3 a -> V3 b -> V3 b #

(<.) :: V3 a -> V3 b -> V3 a #

Bind V3 

Methods

(>>-) :: V3 a -> (a -> V3 b) -> V3 b #

join :: V3 (V3 a) -> V3 a #

Foldable1 V3 

Methods

fold1 :: Semigroup m => V3 m -> m #

foldMap1 :: Semigroup m => (a -> m) -> V3 a -> m #

Shape V3 Source # 
ShapeLift V3 Source # 

Methods

liftShape :: Lift a => V3 a -> Q Exp Source #

liftShape' :: Lift a => V3 a -> Q Exp Source #

Unbox a => Vector Vector (V3 a) 

Methods

basicUnsafeFreeze :: PrimMonad m => Mutable Vector (PrimState m) (V3 a) -> m (Vector (V3 a)) #

basicUnsafeThaw :: PrimMonad m => Vector (V3 a) -> m (Mutable Vector (PrimState m) (V3 a)) #

basicLength :: Vector (V3 a) -> Int #

basicUnsafeSlice :: Int -> Int -> Vector (V3 a) -> Vector (V3 a) #

basicUnsafeIndexM :: Monad m => Vector (V3 a) -> Int -> m (V3 a) #

basicUnsafeCopy :: PrimMonad m => Mutable Vector (PrimState m) (V3 a) -> Vector (V3 a) -> m () #

elemseq :: Vector (V3 a) -> V3 a -> b -> b #

Unbox a => MVector MVector (V3 a) 

Methods

basicLength :: MVector s (V3 a) -> Int #

basicUnsafeSlice :: Int -> Int -> MVector s (V3 a) -> MVector s (V3 a) #

basicOverlaps :: MVector s (V3 a) -> MVector s (V3 a) -> Bool #

basicUnsafeNew :: PrimMonad m => Int -> m (MVector (PrimState m) (V3 a)) #

basicInitialize :: PrimMonad m => MVector (PrimState m) (V3 a) -> m () #

basicUnsafeReplicate :: PrimMonad m => Int -> V3 a -> m (MVector (PrimState m) (V3 a)) #

basicUnsafeRead :: PrimMonad m => MVector (PrimState m) (V3 a) -> Int -> m (V3 a) #

basicUnsafeWrite :: PrimMonad m => MVector (PrimState m) (V3 a) -> Int -> V3 a -> m () #

basicClear :: PrimMonad m => MVector (PrimState m) (V3 a) -> m () #

basicSet :: PrimMonad m => MVector (PrimState m) (V3 a) -> V3 a -> m () #

basicUnsafeCopy :: PrimMonad m => MVector (PrimState m) (V3 a) -> MVector (PrimState m) (V3 a) -> m () #

basicUnsafeMove :: PrimMonad m => MVector (PrimState m) (V3 a) -> MVector (PrimState m) (V3 a) -> m () #

basicUnsafeGrow :: PrimMonad m => MVector (PrimState m) (V3 a) -> Int -> m (MVector (PrimState m) (V3 a)) #

(~) * i Int => HasLayout V3 (V3 i) Source # 

Methods

layout :: Lens' (V3 i) (Layout V3) Source #

Bounded a => Bounded (V3 a) 

Methods

minBound :: V3 a #

maxBound :: V3 a #

Eq a => Eq (V3 a) 

Methods

(==) :: V3 a -> V3 a -> Bool #

(/=) :: V3 a -> V3 a -> Bool #

Floating a => Floating (V3 a) 

Methods

pi :: V3 a #

exp :: V3 a -> V3 a #

log :: V3 a -> V3 a #

sqrt :: V3 a -> V3 a #

(**) :: V3 a -> V3 a -> V3 a #

logBase :: V3 a -> V3 a -> V3 a #

sin :: V3 a -> V3 a #

cos :: V3 a -> V3 a #

tan :: V3 a -> V3 a #

asin :: V3 a -> V3 a #

acos :: V3 a -> V3 a #

atan :: V3 a -> V3 a #

sinh :: V3 a -> V3 a #

cosh :: V3 a -> V3 a #

tanh :: V3 a -> V3 a #

asinh :: V3 a -> V3 a #

acosh :: V3 a -> V3 a #

atanh :: V3 a -> V3 a #

log1p :: V3 a -> V3 a #

expm1 :: V3 a -> V3 a #

log1pexp :: V3 a -> V3 a #

log1mexp :: V3 a -> V3 a #

Fractional a => Fractional (V3 a) 

Methods

(/) :: V3 a -> V3 a -> V3 a #

recip :: V3 a -> V3 a #

fromRational :: Rational -> V3 a #

Data a => Data (V3 a) 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> V3 a -> c (V3 a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (V3 a) #

toConstr :: V3 a -> Constr #

dataTypeOf :: V3 a -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (V3 a)) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (V3 a)) #

gmapT :: (forall b. Data b => b -> b) -> V3 a -> V3 a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> V3 a -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> V3 a -> r #

gmapQ :: (forall d. Data d => d -> u) -> V3 a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> V3 a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> V3 a -> m (V3 a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> V3 a -> m (V3 a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> V3 a -> m (V3 a) #

Num a => Num (V3 a) 

Methods

(+) :: V3 a -> V3 a -> V3 a #

(-) :: V3 a -> V3 a -> V3 a #

(*) :: V3 a -> V3 a -> V3 a #

negate :: V3 a -> V3 a #

abs :: V3 a -> V3 a #

signum :: V3 a -> V3 a #

fromInteger :: Integer -> V3 a #

Ord a => Ord (V3 a) 

Methods

compare :: V3 a -> V3 a -> Ordering #

(<) :: V3 a -> V3 a -> Bool #

(<=) :: V3 a -> V3 a -> Bool #

(>) :: V3 a -> V3 a -> Bool #

(>=) :: V3 a -> V3 a -> Bool #

max :: V3 a -> V3 a -> V3 a #

min :: V3 a -> V3 a -> V3 a #

Read a => Read (V3 a) 
Show a => Show (V3 a) 

Methods

showsPrec :: Int -> V3 a -> ShowS #

show :: V3 a -> String #

showList :: [V3 a] -> ShowS #

Ix a => Ix (V3 a) 

Methods

range :: (V3 a, V3 a) -> [V3 a] #

index :: (V3 a, V3 a) -> V3 a -> Int #

unsafeIndex :: (V3 a, V3 a) -> V3 a -> Int

inRange :: (V3 a, V3 a) -> V3 a -> Bool #

rangeSize :: (V3 a, V3 a) -> Int #

unsafeRangeSize :: (V3 a, V3 a) -> Int

Generic (V3 a) 

Associated Types

type Rep (V3 a) :: * -> * #

Methods

from :: V3 a -> Rep (V3 a) x #

to :: Rep (V3 a) x -> V3 a #

Storable a => Storable (V3 a) 

Methods

sizeOf :: V3 a -> Int #

alignment :: V3 a -> Int #

peekElemOff :: Ptr (V3 a) -> Int -> IO (V3 a) #

pokeElemOff :: Ptr (V3 a) -> Int -> V3 a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (V3 a) #

pokeByteOff :: Ptr b -> Int -> V3 a -> IO () #

peek :: Ptr (V3 a) -> IO (V3 a) #

poke :: Ptr (V3 a) -> V3 a -> IO () #

Binary a => Binary (V3 a) 

Methods

put :: V3 a -> Put #

get :: Get (V3 a) #

putList :: [V3 a] -> Put #

Serial a => Serial (V3 a) 

Methods

serialize :: MonadPut m => V3 a -> m () #

deserialize :: MonadGet m => m (V3 a) #

Serialize a => Serialize (V3 a) 

Methods

put :: Putter (V3 a) #

get :: Get (V3 a) #

NFData a => NFData (V3 a) 

Methods

rnf :: V3 a -> () #

Hashable a => Hashable (V3 a) 

Methods

hashWithSalt :: Int -> V3 a -> Int #

hash :: V3 a -> Int #

Unbox a => Unbox (V3 a) 
Ixed (V3 a) 

Methods

ix :: Index (V3 a) -> Traversal' (V3 a) (IxValue (V3 a)) #

Epsilon a => Epsilon (V3 a) 

Methods

nearZero :: V3 a -> Bool #

FunctorWithIndex (E V3) V3 

Methods

imap :: (E V3 -> a -> b) -> V3 a -> V3 b #

imapped :: (Indexable (E V3) p, Settable f) => p a (f b) -> V3 a -> f (V3 b) #

FoldableWithIndex (E V3) V3 

Methods

ifoldMap :: Monoid m => (E V3 -> a -> m) -> V3 a -> m #

ifolded :: (Indexable (E V3) p, Contravariant f, Applicative f) => p a (f a) -> V3 a -> f (V3 a) #

ifoldr :: (E V3 -> a -> b -> b) -> b -> V3 a -> b #

ifoldl :: (E V3 -> b -> a -> b) -> b -> V3 a -> b #

ifoldr' :: (E V3 -> a -> b -> b) -> b -> V3 a -> b #

ifoldl' :: (E V3 -> b -> a -> b) -> b -> V3 a -> b #

TraversableWithIndex (E V3) V3 

Methods

itraverse :: Applicative f => (E V3 -> a -> f b) -> V3 a -> f (V3 b) #

itraversed :: (Indexable (E V3) p, Applicative f) => p a (f b) -> V3 a -> f (V3 b) #

Each (V3 a) (V3 b) a b 

Methods

each :: Traversal (V3 a) (V3 b) a b #

type Rep1 V3 
type Rep V3 
type Rep V3 = E V3
data MVector s (V3 a) 
data MVector s (V3 a) = MV_V3 ~Int ~(MVector s a)
type Rep (V3 a) 
data Vector (V3 a) 
data Vector (V3 a) = V_V3 ~Int ~(Vector a)
type Index (V3 a) 
type Index (V3 a) = E V3
type IxValue (V3 a) 
type IxValue (V3 a) = a

data V4 a :: * -> * #

A 4-dimensional vector.

Constructors

V4 ~a ~a ~a ~a 

Instances

Monad V4 

Methods

(>>=) :: V4 a -> (a -> V4 b) -> V4 b #

(>>) :: V4 a -> V4 b -> V4 b #

return :: a -> V4 a #

fail :: String -> V4 a #

Functor V4 

Methods

fmap :: (a -> b) -> V4 a -> V4 b #

(<$) :: a -> V4 b -> V4 a #

MonadFix V4 

Methods

mfix :: (a -> V4 a) -> V4 a #

Applicative V4 

Methods

pure :: a -> V4 a #

(<*>) :: V4 (a -> b) -> V4 a -> V4 b #

(*>) :: V4 a -> V4 b -> V4 b #

(<*) :: V4 a -> V4 b -> V4 a #

Foldable V4 

Methods

fold :: Monoid m => V4 m -> m #

foldMap :: Monoid m => (a -> m) -> V4 a -> m #

foldr :: (a -> b -> b) -> b -> V4 a -> b #

foldr' :: (a -> b -> b) -> b -> V4 a -> b #

foldl :: (b -> a -> b) -> b -> V4 a -> b #

foldl' :: (b -> a -> b) -> b -> V4 a -> b #

foldr1 :: (a -> a -> a) -> V4 a -> a #

foldl1 :: (a -> a -> a) -> V4 a -> a #

toList :: V4 a -> [a] #

null :: V4 a -> Bool #

length :: V4 a -> Int #

elem :: Eq a => a -> V4 a -> Bool #

maximum :: Ord a => V4 a -> a #

minimum :: Ord a => V4 a -> a #

sum :: Num a => V4 a -> a #

product :: Num a => V4 a -> a #

Traversable V4 

Methods

traverse :: Applicative f => (a -> f b) -> V4 a -> f (V4 b) #

sequenceA :: Applicative f => V4 (f a) -> f (V4 a) #

mapM :: Monad m => (a -> m b) -> V4 a -> m (V4 b) #

sequence :: Monad m => V4 (m a) -> m (V4 a) #

Generic1 V4 

Associated Types

type Rep1 (V4 :: * -> *) :: * -> * #

Methods

from1 :: V4 a -> Rep1 V4 a #

to1 :: Rep1 V4 a -> V4 a #

Distributive V4 

Methods

distribute :: Functor f => f (V4 a) -> V4 (f a) #

collect :: Functor f => (a -> V4 b) -> f a -> V4 (f b) #

distributeM :: Monad m => m (V4 a) -> V4 (m a) #

collectM :: Monad m => (a -> V4 b) -> m a -> V4 (m b) #

Representable V4 

Associated Types

type Rep (V4 :: * -> *) :: * #

Methods

tabulate :: (Rep V4 -> a) -> V4 a #

index :: V4 a -> Rep V4 -> a #

Eq1 V4 

Methods

liftEq :: (a -> b -> Bool) -> V4 a -> V4 b -> Bool #

Ord1 V4 

Methods

liftCompare :: (a -> b -> Ordering) -> V4 a -> V4 b -> Ordering #

Read1 V4 

Methods

liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (V4 a) #

liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [V4 a] #

Show1 V4 

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> V4 a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [V4 a] -> ShowS #

MonadZip V4 

Methods

mzip :: V4 a -> V4 b -> V4 (a, b) #

mzipWith :: (a -> b -> c) -> V4 a -> V4 b -> V4 c #

munzip :: V4 (a, b) -> (V4 a, V4 b) #

Serial1 V4 

Methods

serializeWith :: MonadPut m => (a -> m ()) -> V4 a -> m () #

deserializeWith :: MonadGet m => m a -> m (V4 a) #

Traversable1 V4 

Methods

traverse1 :: Apply f => (a -> f b) -> V4 a -> f (V4 b) #

sequence1 :: Apply f => V4 (f b) -> f (V4 b) #

R4 V4 

Methods

_w :: Functor f => (a -> f a) -> V4 a -> f (V4 a) #

_xyzw :: Functor f => (V4 a -> f (V4 a)) -> V4 a -> f (V4 a) #

R3 V4 

Methods

_z :: Functor f => (a -> f a) -> V4 a -> f (V4 a) #

_xyz :: Functor f => (V3 a -> f (V3 a)) -> V4 a -> f (V4 a) #

R2 V4 

Methods

_y :: Functor f => (a -> f a) -> V4 a -> f (V4 a) #

_xy :: Functor f => (V2 a -> f (V2 a)) -> V4 a -> f (V4 a) #

R1 V4 

Methods

_x :: Functor f => (a -> f a) -> V4 a -> f (V4 a) #

Metric V4 

Methods

dot :: Num a => V4 a -> V4 a -> a #

quadrance :: Num a => V4 a -> a #

qd :: Num a => V4 a -> V4 a -> a #

distance :: Floating a => V4 a -> V4 a -> a #

norm :: Floating a => V4 a -> a #

signorm :: Floating a => V4 a -> V4 a #

Additive V4 

Methods

zero :: Num a => V4 a #

(^+^) :: Num a => V4 a -> V4 a -> V4 a #

(^-^) :: Num a => V4 a -> V4 a -> V4 a #

lerp :: Num a => a -> V4 a -> V4 a -> V4 a #

liftU2 :: (a -> a -> a) -> V4 a -> V4 a -> V4 a #

liftI2 :: (a -> b -> c) -> V4 a -> V4 b -> V4 c #

Apply V4 

Methods

(<.>) :: V4 (a -> b) -> V4 a -> V4 b #

(.>) :: V4 a -> V4 b -> V4 b #

(<.) :: V4 a -> V4 b -> V4 a #

Bind V4 

Methods

(>>-) :: V4 a -> (a -> V4 b) -> V4 b #

join :: V4 (V4 a) -> V4 a #

Foldable1 V4 

Methods

fold1 :: Semigroup m => V4 m -> m #

foldMap1 :: Semigroup m => (a -> m) -> V4 a -> m #

Shape V4 Source # 
ShapeLift V4 Source # 

Methods

liftShape :: Lift a => V4 a -> Q Exp Source #

liftShape' :: Lift a => V4 a -> Q Exp Source #

Unbox a => Vector Vector (V4 a) 

Methods

basicUnsafeFreeze :: PrimMonad m => Mutable Vector (PrimState m) (V4 a) -> m (Vector (V4 a)) #

basicUnsafeThaw :: PrimMonad m => Vector (V4 a) -> m (Mutable Vector (PrimState m) (V4 a)) #

basicLength :: Vector (V4 a) -> Int #

basicUnsafeSlice :: Int -> Int -> Vector (V4 a) -> Vector (V4 a) #

basicUnsafeIndexM :: Monad m => Vector (V4 a) -> Int -> m (V4 a) #

basicUnsafeCopy :: PrimMonad m => Mutable Vector (PrimState m) (V4 a) -> Vector (V4 a) -> m () #

elemseq :: Vector (V4 a) -> V4 a -> b -> b #

Unbox a => MVector MVector (V4 a) 

Methods

basicLength :: MVector s (V4 a) -> Int #

basicUnsafeSlice :: Int -> Int -> MVector s (V4 a) -> MVector s (V4 a) #

basicOverlaps :: MVector s (V4 a) -> MVector s (V4 a) -> Bool #

basicUnsafeNew :: PrimMonad m => Int -> m (MVector (PrimState m) (V4 a)) #

basicInitialize :: PrimMonad m => MVector (PrimState m) (V4 a) -> m () #

basicUnsafeReplicate :: PrimMonad m => Int -> V4 a -> m (MVector (PrimState m) (V4 a)) #

basicUnsafeRead :: PrimMonad m => MVector (PrimState m) (V4 a) -> Int -> m (V4 a) #

basicUnsafeWrite :: PrimMonad m => MVector (PrimState m) (V4 a) -> Int -> V4 a -> m () #

basicClear :: PrimMonad m => MVector (PrimState m) (V4 a) -> m () #

basicSet :: PrimMonad m => MVector (PrimState m) (V4 a) -> V4 a -> m () #

basicUnsafeCopy :: PrimMonad m => MVector (PrimState m) (V4 a) -> MVector (PrimState m) (V4 a) -> m () #

basicUnsafeMove :: PrimMonad m => MVector (PrimState m) (V4 a) -> MVector (PrimState m) (V4 a) -> m () #

basicUnsafeGrow :: PrimMonad m => MVector (PrimState m) (V4 a) -> Int -> m (MVector (PrimState m) (V4 a)) #

(~) * i Int => HasLayout V4 (V4 i) Source # 

Methods

layout :: Lens' (V4 i) (Layout V4) Source #

Bounded a => Bounded (V4 a) 

Methods

minBound :: V4 a #

maxBound :: V4 a #

Eq a => Eq (V4 a) 

Methods

(==) :: V4 a -> V4 a -> Bool #

(/=) :: V4 a -> V4 a -> Bool #

Floating a => Floating (V4 a) 

Methods

pi :: V4 a #

exp :: V4 a -> V4 a #

log :: V4 a -> V4 a #

sqrt :: V4 a -> V4 a #

(**) :: V4 a -> V4 a -> V4 a #

logBase :: V4 a -> V4 a -> V4 a #

sin :: V4 a -> V4 a #

cos :: V4 a -> V4 a #

tan :: V4 a -> V4 a #

asin :: V4 a -> V4 a #

acos :: V4 a -> V4 a #

atan :: V4 a -> V4 a #

sinh :: V4 a -> V4 a #

cosh :: V4 a -> V4 a #

tanh :: V4 a -> V4 a #

asinh :: V4 a -> V4 a #

acosh :: V4 a -> V4 a #

atanh :: V4 a -> V4 a #

log1p :: V4 a -> V4 a #

expm1 :: V4 a -> V4 a #

log1pexp :: V4 a -> V4 a #

log1mexp :: V4 a -> V4 a #

Fractional a => Fractional (V4 a) 

Methods

(/) :: V4 a -> V4 a -> V4 a #

recip :: V4 a -> V4 a #

fromRational :: Rational -> V4 a #

Data a => Data (V4 a) 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> V4 a -> c (V4 a) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (V4 a) #

toConstr :: V4 a -> Constr #

dataTypeOf :: V4 a -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (V4 a)) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (V4 a)) #

gmapT :: (forall b. Data b => b -> b) -> V4 a -> V4 a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> V4 a -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> V4 a -> r #

gmapQ :: (forall d. Data d => d -> u) -> V4 a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> V4 a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> V4 a -> m (V4 a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> V4 a -> m (V4 a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> V4 a -> m (V4 a) #

Num a => Num (V4 a) 

Methods

(+) :: V4 a -> V4 a -> V4 a #

(-) :: V4 a -> V4 a -> V4 a #

(*) :: V4 a -> V4 a -> V4 a #

negate :: V4 a -> V4 a #

abs :: V4 a -> V4 a #

signum :: V4 a -> V4 a #

fromInteger :: Integer -> V4 a #

Ord a => Ord (V4 a) 

Methods

compare :: V4 a -> V4 a -> Ordering #

(<) :: V4 a -> V4 a -> Bool #

(<=) :: V4 a -> V4 a -> Bool #

(>) :: V4 a -> V4 a -> Bool #

(>=) :: V4 a -> V4 a -> Bool #

max :: V4 a -> V4 a -> V4 a #

min :: V4 a -> V4 a -> V4 a #

Read a => Read (V4 a) 
Show a => Show (V4 a) 

Methods

showsPrec :: Int -> V4 a -> ShowS #

show :: V4 a -> String #

showList :: [V4 a] -> ShowS #

Ix a => Ix (V4 a) 

Methods

range :: (V4 a, V4 a) -> [V4 a] #

index :: (V4 a, V4 a) -> V4 a -> Int #

unsafeIndex :: (V4 a, V4 a) -> V4 a -> Int

inRange :: (V4 a, V4 a) -> V4 a -> Bool #

rangeSize :: (V4 a, V4 a) -> Int #

unsafeRangeSize :: (V4 a, V4 a) -> Int

Generic (V4 a) 

Associated Types

type Rep (V4 a) :: * -> * #

Methods

from :: V4 a -> Rep (V4 a) x #

to :: Rep (V4 a) x -> V4 a #

Storable a => Storable (V4 a) 

Methods

sizeOf :: V4 a -> Int #

alignment :: V4 a -> Int #

peekElemOff :: Ptr (V4 a) -> Int -> IO (V4 a) #

pokeElemOff :: Ptr (V4 a) -> Int -> V4 a -> IO () #

peekByteOff :: Ptr b -> Int -> IO (V4 a) #

pokeByteOff :: Ptr b -> Int -> V4 a -> IO () #

peek :: Ptr (V4 a) -> IO (V4 a) #

poke :: Ptr (V4 a) -> V4 a -> IO () #

Binary a => Binary (V4 a) 

Methods

put :: V4 a -> Put #

get :: Get (V4 a) #

putList :: [V4 a] -> Put #

Serial a => Serial (V4 a) 

Methods

serialize :: MonadPut m => V4 a -> m () #

deserialize :: MonadGet m => m (V4 a) #

Serialize a => Serialize (V4 a) 

Methods

put :: Putter (V4 a) #

get :: Get (V4 a) #

NFData a => NFData (V4 a) 

Methods

rnf :: V4 a -> () #

Hashable a => Hashable (V4 a) 

Methods

hashWithSalt :: Int -> V4 a -> Int #

hash :: V4 a -> Int #

Unbox a => Unbox (V4 a) 
Ixed (V4 a) 

Methods

ix :: Index (V4 a) -> Traversal' (V4 a) (IxValue (V4 a)) #

Epsilon a => Epsilon (V4 a) 

Methods

nearZero :: V4 a -> Bool #

FunctorWithIndex (E V4) V4 

Methods

imap :: (E V4 -> a -> b) -> V4 a -> V4 b #

imapped :: (Indexable (E V4) p, Settable f) => p a (f b) -> V4 a -> f (V4 b) #

FoldableWithIndex (E V4) V4 

Methods

ifoldMap :: Monoid m => (E V4 -> a -> m) -> V4 a -> m #

ifolded :: (Indexable (E V4) p, Contravariant f, Applicative f) => p a (f a) -> V4 a -> f (V4 a) #

ifoldr :: (E V4 -> a -> b -> b) -> b -> V4 a -> b #

ifoldl :: (E V4 -> b -> a -> b) -> b -> V4 a -> b #

ifoldr' :: (E V4 -> a -> b -> b) -> b -> V4 a -> b #

ifoldl' :: (E V4 -> b -> a -> b) -> b -> V4 a -> b #

TraversableWithIndex (E V4) V4 

Methods

itraverse :: Applicative f => (E V4 -> a -> f b) -> V4 a -> f (V4 b) #

itraversed :: (Indexable (E V4) p, Applicative f) => p a (f b) -> V4 a -> f (V4 b) #

Each (V4 a) (V4 b) a b 

Methods

each :: Traversal (V4 a) (V4 b) a b #

type Rep1 V4 
type Rep V4 
type Rep V4 = E V4
data MVector s (V4 a) 
data MVector s (V4 a) = MV_V4 ~Int ~(MVector s a)
type Rep (V4 a) 
data Vector (V4 a) 
data Vector (V4 a) = V_V4 ~Int ~(Vector a)
type Index (V4 a) 
type Index (V4 a) = E V4
type IxValue (V4 a) 
type IxValue (V4 a) = a

class R1 t where #

A space that has at least 1 basis vector _x.

Minimal complete definition

Nothing

Instances

R1 Identity 

Methods

_x :: Functor f => (a -> f a) -> Identity a -> f (Identity a) #

R1 V4 

Methods

_x :: Functor f => (a -> f a) -> V4 a -> f (V4 a) #

R1 V3 

Methods

_x :: Functor f => (a -> f a) -> V3 a -> f (V3 a) #

R1 V2 

Methods

_x :: Functor f => (a -> f a) -> V2 a -> f (V2 a) #

R1 V1 

Methods

_x :: Functor f => (a -> f a) -> V1 a -> f (V1 a) #

class R1 t => R2 t where #

A space that distinguishes 2 orthogonal basis vectors _x and _y, but may have more.

Minimal complete definition

Nothing

Instances

R2 V4 

Methods

_y :: Functor f => (a -> f a) -> V4 a -> f (V4 a) #

_xy :: Functor f => (V2 a -> f (V2 a)) -> V4 a -> f (V4 a) #

R2 V3 

Methods

_y :: Functor f => (a -> f a) -> V3 a -> f (V3 a) #

_xy :: Functor f => (V2 a -> f (V2 a)) -> V3 a -> f (V3 a) #

R2 V2 

Methods

_y :: Functor f => (a -> f a) -> V2 a -> f (V2 a) #

_xy :: Functor f => (V2 a -> f (V2 a)) -> V2 a -> f (V2 a) #

class R2 t => R3 t where #

A space that distinguishes 3 orthogonal basis vectors: _x, _y, and _z. (It may have more)

Minimal complete definition

Nothing

Instances

R3 V4 

Methods

_z :: Functor f => (a -> f a) -> V4 a -> f (V4 a) #

_xyz :: Functor f => (V3 a -> f (V3 a)) -> V4 a -> f (V4 a) #

R3 V3 

Methods

_z :: Functor f => (a -> f a) -> V3 a -> f (V3 a) #

_xyz :: Functor f => (V3 a -> f (V3 a)) -> V3 a -> f (V3 a) #

class R3 t => R4 t where #

A space that distinguishes orthogonal basis vectors _x, _y, _z, _w. (It may have more.)

Minimal complete definition

Nothing

Instances

R4 V4 

Methods

_w :: Functor f => (a -> f a) -> V4 a -> f (V4 a) #

_xyzw :: Functor f => (V4 a -> f (V4 a)) -> V4 a -> f (V4 a) #

Extra planes

_xz :: R3 t => Lens' (t a) (V2 a) #

_yz :: R3 t => Lens' (t a) (V2 a) #

_yx :: R2 t => Lens' (t a) (V2 a) #

>>> V2 1 2 ^. _yx
V2 2 1

_zy :: R3 t => Lens' (t a) (V2 a) #

_zx :: R3 t => Lens' (t a) (V2 a) #