Safe Haskell | None |
---|---|
Language | Haskell98 |
Core type system
- class (NFData (UArray r l sh a), Shape sh) => Regular r l sh a where
- data UArray r l sh a
- class (Regular r l sh (v e), Regular slr l sh e, Vector v e) => VecRegular r slr l sh v e | r -> slr where
- class NFData a where
- rnf :: a -> ()
- deepseq :: NFData a => a -> b -> b
- class (Eq sh, Bounded sh, Show sh, NFData sh) => Shape sh
- type family Dim (v :: * -> *) :: *
- class Arity n
- data Fun n a b :: * -> * -> * -> *
- class Arity (Dim v) => Vector v a
- data VecList n a :: * -> * -> *
- class Regular r l sh a => USource r l sh a where
- class (VecRegular r slr l sh v e, USource r l sh (v e), USource slr l sh e) => UVecSource r slr l sh v e
- class Regular tr tl sh a => UTarget tr tl sh a where
- class (USource r l sh a, UTarget mr l sh a) => Manifest r mr l sh a | r -> mr, mr -> r where
- class (VecRegular tr tslr tl sh v e, UTarget tr tl sh (v e), UTarget tslr tl sh e) => UVecTarget tr tslr tl sh v e
- class WorkIndex sh i => PreferredWorkIndex l sh i | l sh -> i
- class (Shape sh, Shape i) => WorkIndex sh i where
General Regular classes
class (NFData (UArray r l sh a), Shape sh) => Regular r l sh a where Source #
This class generalizes USource
and UTarget
.
Paramenters:
r
- representation,l
- load type,sh
- shape,a
- element type.
Counterpart for arrays of vectors: VecRegular
.
extent :: UArray r l sh a -> sh Source #
Returns the extent an the array.
touchArray :: UArray r l sh a -> IO () Source #
Calling this function on foreign array (F
)
ensures it is still alive (GC haven't picked it).
In other manifest representations, the function defined as return ()
.
touchArray
is lifted to top level in class hierarchy
because in fact foreign representation is the heart of the library.
force :: UArray r l sh a -> IO () Source #
O(1) Ensures that array and all it's real manifest sources are fully evaluated. This function is not for people, it is for GHC compiler.
Default implementation: force arr = arr `deepseq` return ()
Shape sh => Regular DT SH sh a Source # | |
Shape sh => Regular D SH sh a Source # | |
Shape sh => Regular D L sh a Source # | |
Shape sh => Regular FS L sh e Source # | |
Shape sh => Regular F L sh a Source # | |
(Shape sh, NFData a) => Regular MB L sh a Source # | |
(Shape sh, NFData a) => Regular B L sh a Source # | |
Shape sh => Regular CV CVL sh a Source # | |
Regular r l sh a => Regular (CHK r) l sh a Source # | |
(Regular r l sh e, Vector v e) => Regular (SE r) l sh (v e) Source # | |
class (Regular r l sh (v e), Regular slr l sh e, Vector v e) => VecRegular r slr l sh v e | r -> slr where Source #
Class for arrays of vectors.
Paramenters:
r
- (entire) representation. Associated array type for this class is
.UArray
r sh (v e)slr
- slice representationl
- load typesh
- shapev
- vector typee
- vector (not array) element type. Array element type is entire vector:(v e)
.
Counterpart for "simple" arrays: Regular
.
(Shape sh, Vector v e) => VecRegular D D SH sh v e Source # | |
(Shape sh, Vector v e) => VecRegular D D L sh v e Source # | |
(Shape sh, Vector v e, Storable e, Storable (v e)) => VecRegular F FS L sh v e Source # | |
(Regular r l sh e, Shape sh, Vector v e) => VecRegular (SE r) r l sh v e Source # | |
VecRegular r slr l sh v e => VecRegular (CHK r) (CHK slr) l sh v e Source # | |
A class of types that can be fully evaluated.
Since: 1.1.0.0
Nothing
NFData Bool | |
NFData Char | |
NFData Double | |
NFData Float | |
NFData Int | |
NFData Int8 | |
NFData Int16 | |
NFData Int32 | |
NFData Int64 | |
NFData Integer | |
NFData Word | |
NFData Word8 | |
NFData Word16 | |
NFData Word32 | |
NFData Word64 | |
NFData CallStack | Since: 1.4.2.0 |
NFData TypeRep | NOTE: Only defined for Since: 1.4.0.0 |
NFData () | |
NFData TyCon | NOTE: Only defined for Since: 1.4.0.0 |
NFData Natural | Since: 1.4.0.0 |
NFData Void | Since: 1.4.0.0 |
NFData Version | Since: 1.3.0.0 |
NFData Unique | Since: 1.4.0.0 |
NFData ThreadId | Since: 1.4.0.0 |
NFData ExitCode | Since: 1.4.2.0 |
NFData CChar | Since: 1.4.0.0 |
NFData CSChar | Since: 1.4.0.0 |
NFData CUChar | Since: 1.4.0.0 |
NFData CShort | Since: 1.4.0.0 |
NFData CUShort | Since: 1.4.0.0 |
NFData CInt | Since: 1.4.0.0 |
NFData CUInt | Since: 1.4.0.0 |
NFData CLong | Since: 1.4.0.0 |
NFData CULong | Since: 1.4.0.0 |
NFData CLLong | Since: 1.4.0.0 |
NFData CULLong | Since: 1.4.0.0 |
NFData CFloat | Since: 1.4.0.0 |
NFData CDouble | Since: 1.4.0.0 |
NFData CPtrdiff | Since: 1.4.0.0 |
NFData CSize | Since: 1.4.0.0 |
NFData CWchar | Since: 1.4.0.0 |
NFData CSigAtomic | Since: 1.4.0.0 |
NFData CClock | Since: 1.4.0.0 |
NFData CTime | Since: 1.4.0.0 |
NFData CUSeconds | Since: 1.4.0.0 |
NFData CSUSeconds | Since: 1.4.0.0 |
NFData CFile | Since: 1.4.0.0 |
NFData CFpos | Since: 1.4.0.0 |
NFData CJmpBuf | Since: 1.4.0.0 |
NFData CIntPtr | Since: 1.4.0.0 |
NFData CUIntPtr | Since: 1.4.0.0 |
NFData CIntMax | Since: 1.4.0.0 |
NFData CUIntMax | Since: 1.4.0.0 |
NFData All | Since: 1.4.0.0 |
NFData Any | Since: 1.4.0.0 |
NFData Fingerprint | Since: 1.4.0.0 |
NFData SrcLoc | Since: 1.4.2.0 |
NFData Doc | |
NFData TextDetails | |
NFData a => NFData [a] | |
NFData a => NFData (Maybe a) | |
NFData a => NFData (Ratio a) | |
NFData (Ptr a) | Since: 1.4.2.0 |
NFData (FunPtr a) | Since: 1.4.2.0 |
NFData a => NFData (Identity a) | Since: 1.4.0.0 |
NFData a => NFData (Min a) | Since: 1.4.2.0 |
NFData a => NFData (Max a) | Since: 1.4.2.0 |
NFData a => NFData (First a) | Since: 1.4.2.0 |
NFData a => NFData (Last a) | Since: 1.4.2.0 |
NFData m => NFData (WrappedMonoid m) | Since: 1.4.2.0 |
NFData a => NFData (Option a) | Since: 1.4.2.0 |
NFData a => NFData (NonEmpty a) | Since: 1.4.2.0 |
NFData (Fixed a) | Since: 1.3.0.0 |
NFData a => NFData (Complex a) | |
NFData (StableName a) | Since: 1.4.0.0 |
NFData a => NFData (ZipList a) | Since: 1.4.0.0 |
NFData a => NFData (Dual a) | Since: 1.4.0.0 |
NFData a => NFData (Sum a) | Since: 1.4.0.0 |
NFData a => NFData (Product a) | Since: 1.4.0.0 |
NFData a => NFData (First a) | Since: 1.4.0.0 |
NFData a => NFData (Last a) | Since: 1.4.0.0 |
NFData (IORef a) | NOTE: Only strict in the reference and not the referenced value. Since: 1.4.2.0 |
NFData a => NFData (Down a) | Since: 1.4.0.0 |
NFData (MVar a) | NOTE: Only strict in the reference and not the referenced value. Since: 1.4.2.0 |
NFData a => NFData (Only a) | |
NFData (Empty a) | |
NFData a => NFData (Doc a) | |
NFData a => NFData (AnnotDetails a) | |
NFData (a -> b) | This instance is for convenience and consistency with Since: 1.3.0.0 |
(NFData a, NFData b) => NFData (Either a b) | |
(NFData a, NFData b) => NFData (a, b) | |
(NFData a, NFData b) => NFData (Array a b) | |
(NFData a, NFData b) => NFData (Arg a b) | Since: 1.4.2.0 |
NFData (Proxy k a) | Since: 1.4.0.0 |
NFData (STRef s a) | NOTE: Only strict in the reference and not the referenced value. Since: 1.4.2.0 |
(Arity n, NFData a) => NFData (VecList n a) | |
(NFData a, NFData b, NFData c) => NFData (a, b, c) | |
NFData a => NFData (Const k a b) | Since: 1.4.0.0 |
(NFData a, NFData b, NFData c, NFData d) => NFData (a, b, c, d) | |
Shape sh => NFData (UArray DT SH sh a) # | |
Shape sh => NFData (UArray D SH sh a) # | |
Shape sh => NFData (UArray D L sh a) # | |
(NFData (UArray r l sh e), Shape sh, Vector v e) => NFData (UArray (SE r) l sh (v e)) # | |
Shape sh => NFData (UArray FS L sh e) # | |
Shape sh => NFData (UArray F L sh a) # | |
NFData (UArray r l sh a) => NFData (UArray (CHK r) l sh a) # | |
(Shape sh, NFData a) => NFData (UArray MB L sh a) # | |
(Shape sh, NFData a) => NFData (UArray B L sh a) # | |
Shape sh => NFData (UArray CV CVL sh a) # | |
(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5) => NFData (a1, a2, a3, a4, a5) | |
(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5, NFData a6) => NFData (a1, a2, a3, a4, a5, a6) | |
(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5, NFData a6, NFData a7) => NFData (a1, a2, a3, a4, a5, a6, a7) | |
(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5, NFData a6, NFData a7, NFData a8) => NFData (a1, a2, a3, a4, a5, a6, a7, a8) | |
(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5, NFData a6, NFData a7, NFData a8, NFData a9) => NFData (a1, a2, a3, a4, a5, a6, a7, a8, a9) | |
deepseq :: NFData a => a -> b -> b #
deepseq
: fully evaluates the first argument, before returning the
second.
The name deepseq
is used to illustrate the relationship to seq
:
where seq
is shallow in the sense that it only evaluates the top
level of its argument, deepseq
traverses the entire data structure
evaluating it completely.
deepseq
can be useful for forcing pending exceptions,
eradicating space leaks, or forcing lazy I/O to happen. It is
also useful in conjunction with parallel Strategies (see the
parallel
package).
There is no guarantee about the ordering of evaluation. The
implementation may evaluate the components of the structure in
any order or in parallel. To impose an actual order on
evaluation, use pseq
from Control.Parallel in the
parallel
package.
Since: 1.1.0.0
Shape class
class (Eq sh, Bounded sh, Show sh, NFData sh) => Shape sh Source #
Class for column-major, regular composite array indices.
Fixed vector
type family Dim (v :: * -> *) :: * #
Size of vector expressed as type-level natural.
type Dim Complex | |
type Dim Only | |
type Dim Empty | |
type Dim ((,) a) | |
type Dim (Proxy *) | |
type Dim (VecList n) | |
type Dim (ContVec n) | |
type Dim (VecTuple N2) # | |
type Dim (VecTuple N3) # | |
type Dim (VecTuple N4) # | |
type Dim (VecTuple N5) # | |
type Dim (VecTuple N6) # | |
type Dim (VecTuple N8) # | |
type Dim (VecTuple N7) # | |
type Dim ((,,) a b) | |
type Dim ((,,,) a b c) | |
type Dim ((,,,,) a b c d) | |
type Dim ((,,,,,) a b c d e) | |
type Dim ((,,,,,,) a b c d e f) | |
Type class for handling n-ary functions.
data Fun n a b :: * -> * -> * -> * #
Newtype wrapper which is used to make Fn
injective. It's also a
reader monad.
class Arity (Dim v) => Vector v a #
Type class for vectors with fixed length. Instance should provide two functions: one to create vector and another for vector deconstruction. They must obey following law:
inspect v construct = v
RealFloat a => Vector Complex a | |
Vector Only a | |
Vector Empty a | |
(~) * b a => Vector ((,) b) a | Note this instance (and other instances for tuples) is
essentially monomorphic in element type. Vector type v of 2
element tuple |
Vector (Proxy *) a | |
Arity n => Vector (VecList n) a | |
Arity n => Vector (ContVec n) a | |
((~) * b a, (~) * c a) => Vector ((,,) b c) a | |
((~) * b a, (~) * c a, (~) * d a) => Vector ((,,,) b c d) a | |
((~) * b a, (~) * c a, (~) * d a, (~) * e a) => Vector ((,,,,) b c d e) a | |
((~) * b a, (~) * c a, (~) * d a, (~) * e a, (~) * f a) => Vector ((,,,,,) b c d e f) a | |
((~) * b a, (~) * c a, (~) * d a, (~) * e a, (~) * f a, (~) * g a) => Vector ((,,,,,,) b c d e f g) a | |
data VecList n a :: * -> * -> * #
Vector based on the lists. Not very useful by itself but is necessary for implementation.
Arity n => VectorN VecList n a | |
Arity n => Functor (VecList n) | |
Arity n => Applicative (VecList n) | |
Arity n => Foldable (VecList n) | |
Arity n => Traversable (VecList n) | |
Arity n => Vector (VecList n) a | |
(Eq a, Arity n) => Eq (VecList n a) | |
(Ord a, Arity n) => Ord (VecList n a) | |
(Show a, Arity n) => Show (VecList n a) | |
(Arity n, Monoid a) => Monoid (VecList n a) | |
(Storable a, Arity n) => Storable (VecList n a) | |
(Arity n, NFData a) => NFData (VecList n a) | |
type Dim (VecList n) | |
Source classes
class Regular r l sh a => USource r l sh a where Source #
Class for arrays which could be indexed.
It's functions are unsafe: you must call touchArray
after the last call.
Fortunately, you will hardly ever need to call them manually.
Minimum complete defenition: index
or linearIndex
.
Counterpart for arrays of vectors: UVecSource
index :: UArray r l sh a -> sh -> IO a Source #
Shape, genuine monadic indexing.
In Yarr arrays are always zero
-indexed and multidimensionally square.
Maximum index is (extent arr)
.
Default implementation:
index arr sh = linearIndex arr $
toLinear
(extent
arr) sh
linearIndex :: UArray r l sh a -> Int -> IO a Source #
"Surrogate" linear index.
For Dim1
arrays index == linearIndex
.
Default implementation:
linearIndex arr i = index arr $
fromLinear
(extent
arr) i
Shape sh => USource D SH sh a Source # | |
Shape sh => USource D L sh a Source # | |
(Shape sh, Storable e) => USource FS L sh e Source # | |
(Shape sh, Storable a) => USource F L sh a Source # | |
(Shape sh, NFData a) => USource MB L sh a Source # | |
(Shape sh, NFData a) => USource B L sh a Source # | |
Shape sh => USource CV CVL sh a Source # | |
USource r l sh a => USource (CHK r) l sh a Source # | |
(USource r l sh e, Vector v e) => USource (SE r) l sh (v e) Source # | |
class (VecRegular r slr l sh v e, USource r l sh (v e), USource slr l sh e) => UVecSource r slr l sh v e Source #
Class for arrays of vectors which could be indexed. The class doesn't need to define functions, it just gathers it's dependencies.
Counterpart for "simple" arrays: USource
.
(Shape sh, Vector v e) => UVecSource D D SH sh v e Source # | |
(Shape sh, Vector v e) => UVecSource D D L sh v e Source # | |
(Shape sh, Vector v e, Storable e, Storable (v e)) => UVecSource F FS L sh v e Source # | |
(USource r l sh e, Vector v e) => UVecSource (SE r) r l sh v e Source # | |
(Shape sh, Vector v e, Storable e) => UVecSource (SE F) F L sh v e Source # | |
(Shape sh, Vector v e, NFData e) => UVecSource (SE MB) MB L sh v e Source # | |
(Shape sh, Vector v e, NFData e) => UVecSource (SE B) B L sh v e Source # | |
UVecSource r slr l sh v e => UVecSource (CHK r) (CHK slr) l sh v e Source # | |
Manifest and Target classes
class Regular tr tl sh a => UTarget tr tl sh a where Source #
Class for mutable arrays.
Just like for USource
, it's function are unsafe
and require calling touchArray
after the last call.
Minimum complete defenition: write
or linearWrite
.
Counterpart for arrays of vectors: UVecTarget
write :: UArray tr tl sh a -> sh -> a -> IO () Source #
Shape, genuine monadic writing.
Default implementation:
write tarr sh = linearWrite tarr $
toLinear
(extent
tarr) sh
linearWrite :: UArray tr tl sh a -> Int -> a -> IO () Source #
Fast (usually), linear indexing. Intented to be used internally.
Default implementation:
linearWrite tarr i = write tarr $
fromLinear
(extent
tarr) i
Shape sh => UTarget DT SH sh a Source # | |
(Shape sh, Storable e) => UTarget FS L sh e Source # | |
(Shape sh, Storable a) => UTarget F L sh a Source # | |
(Shape sh, NFData a) => UTarget MB L sh a Source # | |
UTarget tr tl sh a => UTarget (CHK tr) tl sh a Source # | |
(UTarget tr tl sh e, Vector v e) => UTarget (SE tr) tl sh (v e) Source # | |
class (USource r l sh a, UTarget mr l sh a) => Manifest r mr l sh a | r -> mr, mr -> r where Source #
Class for arrays which could be created. It combines a pair of representations: freezed and mutable (raw). This segregation is lifted from Boxed representation and, in the final, from GHC system of primitive arrays.
Parameters:
r
- freezed array representation.mr
- mutable, raw array representationl
- load type index, common for both representationssh
- shape of arraysa
- element type
new :: sh -> IO (UArray mr l sh a) Source #
O(1) Creates and returns mutable array of the given shape.
freeze :: UArray mr l sh a -> IO (UArray r l sh a) Source #
O(1) Freezes mutable array and returns array which could be indexed.
thaw :: UArray r l sh a -> IO (UArray mr l sh a) Source #
O(1) Thaws freezed array and returns mutable version.
class (VecRegular tr tslr tl sh v e, UTarget tr tl sh (v e), UTarget tslr tl sh e) => UVecTarget tr tslr tl sh v e Source #
Class for mutable arrays of vectors. The class doesn't need to define functions, it just gathers it's dependencies.
Counterpart for "simple" arrays: UTarget
.
Work index
class WorkIndex sh i => PreferredWorkIndex l sh i | l sh -> i Source #
Type level fixation of preferred work (load, fold, etc.) index type of the array load type.
Parameters:
l
- load type indexsh
- shape of arraysi
- preferred work index,Int
orsh
itself
class (Shape sh, Shape i) => WorkIndex sh i where Source #
Internal implementation class. Generalizes linear-
and simple
indexing and writing function in USource
and UTarget
classes.