Copyright | (c) Alexey Kuleshevich 2018 |
---|---|
License | BSD3 |
Maintainer | Alexey Kuleshevich <lehins@yandex.ru> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- class Source r ix e => Manifest r ix e
- toManifest :: Manifest r ix e => Array r ix e -> Array M ix e
- data M
- data B = B
- data N = N
- data P = P
- class Prim a
- data S = S
- class Storable a
- withPtr :: (Index ix, Storable a) => MArray RealWorld S ix a -> (Ptr a -> IO b) -> IO b
- unsafeWithPtr :: Storable a => Array S ix a -> (Ptr a -> IO b) -> IO b
- data U = U
- class (Vector Vector a, MVector MVector a) => Unbox a
Manifest
class Source r ix e => Manifest r ix e Source #
Manifest arrays are backed by actual memory and values are looked up versus
computed as it is with delayed arrays. Because of this fact indexing functions
(
, !
)(
, etc. are constrained to manifest arrays only.!?
)
Instances
Index ix => Manifest M ix e Source # | |
Defined in Data.Massiv.Array.Manifest.Internal | |
(Unbox e, Index ix) => Manifest U ix e Source # | |
Defined in Data.Massiv.Array.Manifest.Unboxed | |
(Index ix, Storable e) => Manifest S ix e Source # | |
Defined in Data.Massiv.Array.Manifest.Storable | |
(Index ix, Prim e) => Manifest P ix e Source # | |
Defined in Data.Massiv.Array.Manifest.Primitive | |
(Index ix, NFData e) => Manifest N ix e Source # | |
Defined in Data.Massiv.Array.Manifest.BoxedNF | |
Index ix => Manifest B ix e Source # | |
Defined in Data.Massiv.Array.Manifest.BoxedStrict |
General Manifest representation
Instances
Index ix => Manifest M ix e Source # | |
Defined in Data.Massiv.Array.Manifest.Internal | |
(Index ix, Index (Lower ix), Elt M ix e ~ Array M (Lower ix) e) => Slice M ix e Source # | |
Defined in Data.Massiv.Array.Manifest.Internal | |
Slice M Ix1 e Source # | |
(Elt M ix e ~ Array M (Lower ix) e, Index ix, Index (Lower ix)) => InnerSlice M ix e Source # | |
InnerSlice M Ix1 e Source # | |
(Elt M ix e ~ Array M (Lower ix) e, Index ix, Index (Lower ix)) => OuterSlice M ix e Source # | |
Defined in Data.Massiv.Array.Manifest.Internal | |
OuterSlice M Ix1 e Source # | |
Index ix => Load M ix e Source # | |
Index ix => Source M ix e Source # | |
Defined in Data.Massiv.Array.Manifest.Internal | |
Index ix => Size M ix e Source # | |
Index ix => Construct M ix e Source # | |
Index ix => Foldable (Array M ix) Source # | Row-major sequential folding over a Manifest array. |
Defined in Data.Massiv.Array.Manifest.Internal fold :: Monoid m => Array M ix m -> m # foldMap :: Monoid m => (a -> m) -> Array M ix a -> m # foldr :: (a -> b -> b) -> b -> Array M ix a -> b # foldr' :: (a -> b -> b) -> b -> Array M ix a -> b # foldl :: (b -> a -> b) -> b -> Array M ix a -> b # foldl' :: (b -> a -> b) -> b -> Array M ix a -> b # foldr1 :: (a -> a -> a) -> Array M ix a -> a # foldl1 :: (a -> a -> a) -> Array M ix a -> a # toList :: Array M ix a -> [a] # null :: Array M ix a -> Bool # length :: Array M ix a -> Int # elem :: Eq a => a -> Array M ix a -> Bool # maximum :: Ord a => Array M ix a -> a # minimum :: Ord a => Array M ix a -> a # | |
data Array M ix e Source # | |
Defined in Data.Massiv.Array.Manifest.Internal | |
type EltRepr M ix Source # | |
Defined in Data.Massiv.Array.Manifest.Internal |
Boxed
Array representation for Boxed elements. This structure is element and spine strict, but elements are strict to Weak Head Normal Form (WHNF) only.
Instances
Array representation for Boxed elements. This structure is element and
spine strict, and elements are always in Normal Form (NF), therefore NFData
instance is required.
Instances
Primitive
Representation for Prim
itive elements
Instances
Class of types supporting primitive array operations
sizeOf#, alignment#, indexByteArray#, readByteArray#, writeByteArray#, setByteArray#, indexOffAddr#, readOffAddr#, writeOffAddr#, setOffAddr#
Instances
Storable
Representation for Storable
elements
Instances
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
withPtr :: (Index ix, Storable a) => MArray RealWorld S ix a -> (Ptr a -> IO b) -> IO b Source #
A pointer to the beginning of the mutable array.
Since: massiv-0.1.3
unsafeWithPtr :: Storable a => Array S ix a -> (Ptr a -> IO b) -> IO b Source #
A pointer to the beginning of originally created array, i.e. various index manipulation functions that do slicing, extracting, etc. have no affect on this pointer.
Since: massiv-0.1.3
Unboxed
Representation for Unbox
ed elements
Instances
class (Vector Vector a, MVector MVector a) => Unbox a #