Copyright  (c) Christopher Chalmers 

License  BSD3 
Maintainer  Christopher Chalmers 
Stability  provisional 
Portability  nonportable 
Safe Haskell  None 
Language  Haskell2010 
Storeable
multidimentional arrays.
Synopsis
 type SArray = Array Vector
 class Storable a
 class (Eq1 f, Additive f, Traversable f) => Shape f
 class Shape f => HasLayout f a  a > f where
 type Layout f = f Int
 extent :: HasLayout f a => a > f Int
 size :: HasLayout f a => a > Int
 indexes :: HasLayout f a => IndexedFold Int a (f Int)
 indexesFrom :: HasLayout f a => f Int > IndexedFold Int a (f Int)
 indexesBetween :: HasLayout f a => f Int > f Int > IndexedFold Int a (f Int)
 vector :: (Storable a, Storable b) => IndexedLens (Layout f) (SArray f a) (SArray f b) (Vector a) (Vector b)
 values :: (Shape f, Storable a, Storable b) => IndexedTraversal (f Int) (SArray f a) (SArray f b) a b
 values' :: (Shape f, Storable a, Storable b) => IndexedTraversal (f Int) (SArray f a) (SArray f b) a b
 valuesBetween :: (Shape f, Storable a) => f Int > f Int > IndexedTraversal' (f Int) (SArray f a) a
 flat :: Storable b => Iso (SArray V1 a) (SArray V1 b) (Vector a) (Vector b)
 fromList :: Storable a => [a] > SArray V1 a
 fromListInto :: (Shape f, Storable a) => Layout f > [a] > Maybe (SArray f a)
 fromListInto_ :: (Shape f, Storable a) => Layout f > [a] > SArray f a
 fromVectorInto :: (Shape f, Storable a) => Layout f > Vector a > Maybe (SArray f a)
 fromVectorInto_ :: (Shape f, Storable a) => Layout f > Vector a > SArray f a
 replicate :: (Shape f, Storable a) => f Int > a > SArray f a
 generate :: (Shape f, Storable a) => Layout f > (f Int > a) > SArray f a
 linearGenerate :: (Shape f, Storable a) => Layout f > (Int > a) > SArray f a
 create :: Storable a => (forall s. ST s (SMArray f s a)) > SArray f a
 replicateM :: (Monad m, Shape f, Storable a) => Layout f > m a > m (SArray f a)
 generateM :: (Monad m, Shape f, Storable a) => Layout f > (f Int > m a) > m (SArray f a)
 linearGenerateM :: (Monad m, Shape f, Storable a) => Layout f > (Int > m a) > m (SArray f a)
 empty :: (Storable a, Additive f) => SArray f a
 null :: Foldable f => SArray f a > Bool
 (!) :: (Shape f, Storable a) => SArray f a > f Int > a
 (!?) :: (Shape f, Storable a) => SArray f a > f Int > Maybe a
 unsafeIndex :: (Shape f, Storable a) => SArray f a > f Int > a
 linearIndex :: Storable a => SArray f a > Int > a
 unsafeLinearIndex :: Storable a => SArray f a > Int > a
 indexM :: (Shape f, Storable a, Monad m) => SArray f a > f Int > m a
 unsafeIndexM :: (Shape f, Storable a, Monad m) => SArray f a > f Int > m a
 linearIndexM :: (Shape f, Storable a, Monad m) => SArray f a > Int > m a
 unsafeLinearIndexM :: (Storable a, Monad m) => SArray f a > Int > m a
 (//) :: (Storable a, Shape f) => SArray f a > [(f Int, a)] > SArray f a
 accum :: (Shape f, Storable a) => (a > b > a) > SArray f a > [(f Int, b)] > SArray f a
 map :: (Storable a, Storable b) => (a > b) > SArray f a > SArray f b
 imap :: (Shape f, Storable a, Storable b) => (f Int > a > b) > SArray f a > SArray f b
 zipWith :: (Shape f, Storable a, Storable b, Storable c) => (a > b > c) > SArray f a > SArray f b > SArray f c
 zipWith3 :: (Shape f, Storable a, Storable b, Storable c, Storable d) => (a > b > c > d) > SArray f a > SArray f b > SArray f c > SArray f d
 izipWith :: (Shape f, Storable a, Storable b, Storable c) => (f Int > a > b > c) > SArray f a > SArray f b > SArray f c
 izipWith3 :: (Shape f, Storable a, Storable b, Storable c, Storable d) => (f Int > a > b > c > d) > SArray f a > SArray f b > SArray f c > SArray f d
 ixRow :: Storable a => Int > IndexedTraversal' Int (SArray V2 a) (Vector a)
 rows :: (Storable a, Storable b) => IndexedTraversal Int (SArray V2 a) (SArray V2 b) (Vector a) (Vector b)
 ixColumn :: Storable a => Int > IndexedTraversal' Int (SArray V2 a) (Vector a)
 columns :: (Storable a, Storable b) => IndexedTraversal Int (SArray V2 a) (SArray V2 b) (Vector a) (Vector b)
 ixPlane :: Storable a => ALens' (V3 Int) (V2 Int) > Int > IndexedTraversal' Int (SArray V3 a) (SArray V2 a)
 planes :: (Storable a, Storable b) => ALens' (V3 Int) (V2 Int) > IndexedTraversal Int (SArray V3 a) (SArray V3 b) (SArray V2 a) (SArray V2 b)
 flattenPlane :: (Storable a, Storable b) => ALens' (V3 Int) (V2 Int) > (Vector a > b) > SArray V3 a > SArray V2 b
 unsafeOrdinals :: (Storable a, Shape f) => [f Int] > IndexedTraversal' (f Int) (SArray f a) a
 type SMArray = MArray MVector
 thaw :: (PrimMonad m, Storable a) => SArray f a > m (SMArray f (PrimState m) a)
 freeze :: (PrimMonad m, Storable a) => SMArray f (PrimState m) a > m (SArray f a)
 unsafeThaw :: (PrimMonad m, Storable a) => SArray f a > m (SMArray f (PrimState m) a)
 unsafeFreeze :: (PrimMonad m, Storable a) => SMArray f (PrimState m) a > m (SArray f a)
 data Delayed f a
 delayed :: (Storable a, Storable b, Shape f, Shape k) => Iso (SArray f a) (SArray k b) (Delayed f a) (Delayed k b)
 seqDelayed :: (Storable a, Storable b, Shape f, Shape k) => Iso (SArray f a) (SArray k b) (Delayed f a) (Delayed k b)
 delay :: (Storable a, Shape f) => SArray f a > Delayed f a
 manifest :: (Storable a, Shape f) => Delayed f a > SArray f a
 seqManifest :: (Storable a, Shape f) => Delayed f a > SArray f a
 genDelayed :: Layout f > (f Int > a) > Delayed f a
 indexDelayed :: Shape f => Delayed f a > f Int > a
 affirm :: (Shape f, Storable a) => Delayed f a > Delayed f a
 seqAffirm :: (Shape f, Storable a) => Delayed f a > Delayed f a
 data Focused f a
 focusOn :: f Int > Delayed f a > Focused f a
 unfocus :: Focused f a > Delayed f a
 unfocused :: IndexedLens (f Int) (Focused f a) (Focused f b) (Delayed f a) (Delayed f b)
 extendFocus :: Shape f => (Focused f a > b) > Delayed f a > Delayed f b
 locale :: ComonadStore s w => Lens' (w a) s
 shiftFocus :: Applicative f => f Int > Focused f a > Focused f a
 unsafeWithPtr :: Storable a => SArray f a > (Ptr a > IO b) > IO b
 unsafeToForeignPtr :: Storable a => SArray f a > ForeignPtr a
 unsafeFromForeignPtr :: (Shape f, Storable a) => Layout f > ForeignPtr a > SArray f a
SArray types
The member functions of this class facilitate writing values of primitive types to raw memory (which may have been allocated with the above mentioned routines) and reading values from blocks of raw memory. The class, furthermore, includes support for computing the storage requirements and alignment restrictions of storable types.
Memory addresses are represented as values of type
, for some
Ptr
aa
which is an instance of class Storable
. The type argument to
Ptr
helps provide some valuable type safety in FFI code (you can't
mix pointers of different types without an explicit cast), while
helping the Haskell type system figure out which marshalling method is
needed for a given pointer.
All marshalling between Haskell and a foreign language ultimately
boils down to translating Haskell data structures into the binary
representation of a corresponding data structure of the foreign
language and vice versa. To code this marshalling in Haskell, it is
necessary to manipulate primitive data types stored in unstructured
memory blocks. The class Storable
facilitates this manipulation on
all types for which it is instantiated, which are the standard basic
types of Haskell, the fixed size Int
types (Int8
, Int16
,
Int32
, Int64
), the fixed size Word
types (Word8
, Word16
,
Word32
, Word64
), StablePtr
, all types from Foreign.C.Types,
as well as Ptr
.
sizeOf, alignment, (peek  peekElemOff  peekByteOff), (poke  pokeElemOff  pokeByteOff)
Instances
class (Eq1 f, Additive f, Traversable f) => Shape f Source #
Class for types that can be converted to and from linear indexes.
Instances
Layout of an array
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.
Nothing
Instances
i ~ Int => HasLayout V0 (V0 i) Source #  
i ~ Int => HasLayout V4 (V4 i) Source #  
i ~ Int => HasLayout V3 (V3 i) Source #  
i ~ Int => HasLayout V2 (V2 i) Source #  
i ~ Int => HasLayout V1 (V1 i) Source #  
Shape f => HasLayout f (Focused f a) Source #  The 
Shape f => HasLayout f (Delayed f a) Source #  The 
Shape f => HasLayout f (Array v f a) Source #  The 
Shape f => HasLayout f (MArray v f s a) Source #  
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.
Extracting size
Folds over indexes
indexes :: HasLayout f a => IndexedFold Int a (f Int) Source #
Indexed fold for all the indexes in the 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.
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.
Underlying vector
vector :: (Storable a, Storable b) => IndexedLens (Layout f) (SArray f a) (SArray f b) (Vector a) (Vector b) Source #
Traversals
values :: (Shape f, Storable a, Storable b) => IndexedTraversal (f Int) (SArray f a) (SArray f b) a b Source #
Same as values
but restrictive in the vector type.
values' :: (Shape f, Storable a, Storable b) => IndexedTraversal (f Int) (SArray f a) (SArray f b) a b Source #
Same as values
but restrictive in the vector type.
valuesBetween :: (Shape f, Storable a) => f Int > f Int > IndexedTraversal' (f Int) (SArray f a) a Source #
Same as values
but restrictive in the vector type.
Construction
Flat arrays
From lists
fromListInto :: (Shape f, Storable a) => Layout f > [a] > Maybe (SArray f a) Source #
O(n) Convert the first n
elements of a list to an SArrayith the
given shape. Returns Nothing
if there are not enough elements in
the list.
fromListInto_ :: (Shape f, Storable a) => Layout f > [a] > SArray f a Source #
O(n) Convert the first n
elements of a list to an SArrayith the
given shape. Throw an error if the list is not long enough.
From vectors
Initialisation
replicate :: (Shape f, Storable a) => f Int > a > SArray f a Source #
O(n) SArray of the given shape with the same value in each position.
generate :: (Shape f, Storable a) => Layout f > (f Int > a) > SArray f a Source #
O(n) Construct an array of the given shape by applying the function to each index.
linearGenerate :: (Shape f, Storable a) => Layout f > (Int > a) > SArray f a Source #
O(n) Construct an array of the given shape by applying the function to each index.
Monadic initialisation
create :: Storable a => (forall s. ST s (SMArray f s a)) > SArray f a Source #
Execute the monadic action and freeze the resulting array.
replicateM :: (Monad m, Shape f, Storable a) => Layout f > m a > m (SArray f a) Source #
O(n) Construct an array of the given shape by filling each position with the monadic value.
generateM :: (Monad m, Shape f, Storable a) => Layout f > (f Int > m a) > m (SArray f a) Source #
O(n) Construct an array of the given shape by applying the monadic function to each index.
linearGenerateM :: (Monad m, Shape f, Storable a) => Layout f > (Int > m a) > m (SArray f a) Source #
O(n) Construct an array of the given shape by applying the monadic function to each index.
Functions on arrays
Empty arrays
Indexing
(!) :: (Shape f, Storable a) => SArray f a > f Int > a Source #
Index an element of an array. Throws IndexOutOfBounds
if the
index is out of bounds.
unsafeIndex :: (Shape f, Storable a) => SArray f a > f Int > a Source #
Index an element of an array without bounds checking.
linearIndex :: Storable a => SArray f a > Int > a Source #
Index an element of an array while ignoring its shape.
unsafeLinearIndex :: Storable a => SArray f a > Int > a Source #
Index an element of an array while ignoring its shape, without bounds checking.
Monadic indexing
indexM :: (Shape f, Storable a, Monad m) => SArray f a > f Int > m a Source #
O(1) Indexing in a monad.
The monad allows operations to be strict in the vector when necessary. Suppose vector copying is implemented like this:
copy mv v = ... write mv i (v ! i) ...
For lazy vectors, v ! i
would not be evaluated which means that
mv
would unnecessarily retain a reference to v
in each element
written.
With indexM
, copying can be implemented like this instead:
copy mv v = ... do x < indexM v i write mv i x
Here, no references to v
are retained because indexing (but not
the elements) is evaluated eagerly.
Throws an error if the index is out of range.
unsafeIndexM :: (Shape f, Storable a, Monad m) => SArray f a > f Int > m a Source #
O(1) Indexing in a monad without bounds checks. See indexM
for an
explanation of why this is useful.
linearIndexM :: (Shape f, Storable a, Monad m) => SArray f a > Int > m a Source #
O(1) Indexing in a monad. Throws an error if the index is out of range.
unsafeLinearIndexM :: (Storable a, Monad m) => SArray f a > Int > m a Source #
O(1) Indexing in a monad without bounds checks. See indexM
for an
explanation of why this is useful.
Modifying arrays
Bulk updates
(//) :: (Storable a, Shape f) => SArray f a > [(f Int, a)] > SArray f a Source #
For each pair (i,a) from the list, replace the array element at position i by a.
Accumulations
:: (Shape f, Storable a)  
=> (a > b > a)  accumulating function 
> SArray f a  initial array 
> [(f Int, b)]  list of index/value pairs (of length 
> SArray f a 
O(m+n) For each pair (i,b)
from the list, replace the array element
a
at position i
by f a b
.
Mapping
map :: (Storable a, Storable b) => (a > b) > SArray f a > SArray f b Source #
O(n) Map a function over an array
imap :: (Shape f, Storable a, Storable b) => (f Int > a > b) > SArray f a > SArray f b Source #
O(n) Apply a function to every element of a vector and its index
Zipping
Zip with function
zipWith :: (Shape f, Storable a, Storable b, Storable c) => (a > b > c) > SArray f a > SArray f b > SArray f c Source #
Zip two arrays using the given function. If the array's don't have the same shape, the new array with be the intersection of the two shapes.
zipWith3 :: (Shape f, Storable a, Storable b, Storable c, Storable d) => (a > b > c > d) > SArray f a > SArray f b > SArray f c > SArray f d Source #
Zip three arrays using the given function. If the array's don't have the same shape, the new array with be the intersection of the two shapes.
izipWith :: (Shape f, Storable a, Storable b, Storable c) => (f Int > a > b > c) > SArray f a > SArray f b > SArray f c Source #
Zip two arrays using the given function with access to the index. If the array's don't have the same shape, the new array with be the intersection of the two shapes.
izipWith3 :: (Shape f, Storable a, Storable b, Storable c, Storable d) => (f Int > a > b > c > d) > SArray f a > SArray f b > SArray f c > SArray f d Source #
Zip two arrays using the given function with access to the index. If the array's don't have the same shape, the new array with be the intersection of the two shapes.
Slices
Matrix
ixRow :: Storable a => Int > IndexedTraversal' Int (SArray V2 a) (Vector a) Source #
Affine traversal over a single row in a matrix.
>>>
traverseOf_ rows print $ m & ixRow 1 . each +~ 2
[1,2,3] [6,7,8]
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 .~ V.fromList [0,1]
[1,2,3] [0,1,6]
>>>
traverseOf_ rows print $ m & ixRow 1 .~ V.fromList [0..100]
[1,2,3] [0,1,2]
rows :: (Storable a, Storable b) => IndexedTraversal Int (SArray V2 a) (SArray V2 b) (Vector a) (Vector b) Source #
Indexed traversal over the rows of a matrix. Each row is an
efficient slice
of the original vector.
>>>
traverseOf_ rows print m
[1,2,3] [4,5,6]
ixColumn :: Storable a => Int > IndexedTraversal' Int (SArray V2 a) (Vector a) Source #
Affine traversal over a single column in a matrix.
>>>
traverseOf_ rows print $ m & ixColumn 2 . each *~ 10
[1,2,30] [4,5,60]
columns :: (Storable a, Storable b) => IndexedTraversal Int (SArray V2 a) (SArray V2 b) (Vector a) (Vector b) Source #
Indexed traversal over the columns of a matrix. Unlike rows
, each
column is a new separate vector.
>>>
traverseOf_ columns print m
[1,4] [2,5] [3,6]
>>>
traverseOf_ rows print $ m & columns . indices odd . each .~ 0
[1,0,3] [4,0,6]
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 :: Storable a => ALens' (V3 Int) (V2 Int) > Int > IndexedTraversal' Int (SArray V3 a) (SArray V2 a) Source #
planes :: (Storable a, Storable b) => ALens' (V3 Int) (V2 Int) > IndexedTraversal Int (SArray V3 a) (SArray V3 b) (SArray V2 a) (SArray V2 b) Source #
flattenPlane :: (Storable a, Storable b) => ALens' (V3 Int) (V2 Int) > (Vector a > b) > SArray V3 a > SArray V2 b Source #
Flatten a plane by reducing a vector in the third dimension to a single value.
Ordinals
unsafeOrdinals :: (Storable a, Shape f) => [f Int] > IndexedTraversal' (f Int) (SArray f a) a Source #
This Traversal
should not have any duplicates in the list of
indices.
Mutable
thaw :: (PrimMonad m, Storable a) => SArray f a > m (SMArray f (PrimState m) a) Source #
O(n) Yield an immutable copy of the mutable array.
freeze :: (PrimMonad m, Storable a) => SMArray f (PrimState m) a > m (SArray f a) Source #
O(n) Yield a mutable copy of the immutable vector.
unsafeThaw :: (PrimMonad m, Storable a) => SArray f a > m (SMArray f (PrimState m) a) Source #
O(1) Unsafely convert an immutable array to a mutable one without copying. The immutable array may not be used after this operation.
unsafeFreeze :: (PrimMonad m, Storable a) => SMArray f (PrimState m) a > m (SArray f a) Source #
O(1) Unsafe convert a mutable array to an immutable one without copying. The mutable array may not be used after this operation.
Delayed
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 
Functor (Delayed f) Source #  
Shape f => Foldable (Delayed f) Source # 

Defined in Data.Dense.Base fold :: Monoid m => Delayed f m > m # foldMap :: Monoid m => (a > m) > Delayed f a > 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] # 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 #  
Shape f => Traversable (Delayed f) Source #  
Shape f => Apply (Delayed f) Source #  
Shape f => Metric (Delayed f) Source #  
Defined in Data.Dense.Base  
Shape f => Additive (Delayed f) Source #  
Defined in Data.Dense.Base 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 #  
FunctorWithIndex (f Int) (Delayed f) Source #  
Shape f => FoldableWithIndex (f Int) (Delayed f) Source # 

Defined in Data.Dense.Base ifoldMap :: Monoid m => (f Int > a > m) > Delayed f a > m # ifolded :: IndexedFold (f Int) (Delayed f a) 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 #  
Defined in Data.Dense.Base itraverse :: Applicative f0 => (f Int > a > f0 b) > Delayed f a > f0 (Delayed f b) # itraversed :: IndexedTraversal (f Int) (Delayed f a) (Delayed f b) a b #  
(Shape f, Show1 f, Show a) => Show (Delayed f a) Source #  
Shape f => Ixed (Delayed f a) Source #  
Defined in Data.Dense.Base  
Shape f => AsEmpty (Delayed f a) Source #  
Defined in Data.Dense.Base  
Shape f => Each (Delayed f a) (Delayed f b) a b Source #  
type Index (Delayed f a) Source #  
Defined in Data.Dense.Base  
type IxValue (Delayed f a) Source #  
Defined in Data.Dense.Base 
Generating delayed
delayed :: (Storable a, Storable b, Shape f, Shape k) => Iso (SArray f a) (SArray k b) (Delayed f a) (Delayed k b) Source #
Isomorphism between an array and its delayed representation. Conversion to the array is done in parallel.
seqDelayed :: (Storable a, Storable b, Shape f, Shape k) => Iso (SArray f a) (SArray k b) (Delayed f a) (Delayed k b) Source #
Isomorphism between an array and its delayed representation. Conversion to the array is done in sequence.
delay :: (Storable a, Shape f) => SArray f a > Delayed f a Source #
Turn a material array into a delayed one with the same shape.
manifest :: (Storable a, Shape f) => Delayed f a > SArray f a Source #
Parallel manifestation of a delayed array into a material one.
seqManifest :: (Storable a, Shape f) => Delayed f a > SArray f a Source #
Sequential manifestation of a delayed array.
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.
seqAffirm :: (Shape f, Storable a) => Delayed f a > Delayed f a Source #
seqManifest
an array to a SArray
and delay again.
Focused
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 
Functor (Focused f) Source #  
Shape f => Foldable (Focused f) Source #  
Defined in Data.Dense.Base fold :: Monoid m => Focused f m > m # foldMap :: Monoid m => (a > m) > Focused f a > 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] # 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 #  
Shape f => Traversable (Focused f) Source #  
Shape f => Comonad (Focused f) Source #  
Shape f => Extend (Focused f) Source #  
Shape f => ComonadStore (f Int) (Focused f) Source #  
Defined in Data.Dense.Base  
Shape f => FunctorWithIndex (f Int) (Focused f) Source #  Index relative to focus. 
Shape f => FoldableWithIndex (f Int) (Focused f) Source #  Index relative to focus. 
Defined in Data.Dense.Base ifoldMap :: Monoid m => (f Int > a > m) > Focused f a > m # ifolded :: IndexedFold (f Int) (Focused f a) 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. 
Defined in Data.Dense.Base itraverse :: Applicative f0 => (f Int > a > f0 b) > Focused f a > f0 (Focused f b) # itraversed :: IndexedTraversal (f Int) (Focused f a) (Focused f b) a b #  
(Shape f, Show1 f, Show a) => Show (Focused f a) Source #  
Shape f => Ixed (Focused f a) Source #  Index relative to focus. 
Defined in Data.Dense.Base  
type Index (Focused f a) Source #  
Defined in Data.Dense.Base  
type IxValue (Focused f a) Source #  
Defined in Data.Dense.Base 
Generating focused
focusOn :: f Int > Delayed f a > Focused f a Source #
Focus on a particular element of a 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.
Focus location
locale :: ComonadStore s w => Lens' (w a) s Source #
Lens onto the position of a ComonadStore
.
locale
::Lens'
(Focused
l a) (lInt
)
shiftFocus :: Applicative f => f Int > Focused f a > Focused f a Source #
Focus on a neighbouring element, relative to the current focus.
Pointers
unsafeWithPtr :: Storable a => SArray f a > (Ptr a > IO b) > IO b Source #
Pass a pointer to the array's data to the IO action. Modifying
data through the Ptr
is unsafe.
unsafeToForeignPtr :: Storable a => SArray f a > ForeignPtr a Source #
Yield the underlying ForeignPtr. Modifying the data through the
ForeignPtr
is unsafe.
unsafeFromForeignPtr :: (Shape f, Storable a) => Layout f > ForeignPtr a > SArray f a Source #
O(1) Create an array from a layout and ForeignPtr
. It is
assumed the pointer points directly to the data (no offset).
Modifying data through the ForeignPtr
afterwards is unsafe.