Safe Haskell | None |
---|---|
Language | Haskell2010 |
Arrays
Stuff to make it easier to work with arrays from the array package, especially when it comes to unboxed arrays. If the vector package is available, just use that.
Synopsis
- class Unbox a where
- data Arr arr i a
- type UArr = Arr UArray
- type IOUArr = Arr IOUArray
- type STUArr s = Arr (STUArray s)
- data Arr2 arra arrb i ab
- type UArr2 = Arr2 UArray UArray
- type UArr3 = Arr2 UArray UArr2
- type UArr4 = Arr2 UArr2 UArr2
- type STUArr2 s = Arr2 (STUArray s) (STUArray s)
- type STUArr3 s = Arr2 (STUArray s) (STUArr2 s)
- type STUArr4 s = Arr2 (STUArr2 s) (STUArr2 s)
- type IOUArr2 = Arr2 IOUArray IOUArray
- type IOUArr3 = Arr2 IOUArray IOUArr2
- type IOUArr4 = Arr2 IOUArr2 IOUArr2
Documentation
Nothing
Array type for element types isomorphic to other element types with existing array support. Primarily intended as a way to get unboxed arrays. As an example, if you have "newtype N = N Int", define "instance Unbox N where type Unboxed N = Int" and use UArr i N as an unboxed array for N. This is a lot more performant than a boxed Array i N. Also works with mutable arrays, IOUArr and STUArr.
Instances
(Unbox a, IArray arr (Unboxed a)) => IArray (Arr arr) a Source # | |
Defined in Array bounds :: Ix i => Arr arr i a -> (i, i) # numElements :: Ix i => Arr arr i a -> Int unsafeArray :: Ix i => (i, i) -> [(Int, a)] -> Arr arr i a unsafeAt :: Ix i => Arr arr i a -> Int -> a unsafeReplace :: Ix i => Arr arr i a -> [(Int, a)] -> Arr arr i a unsafeAccum :: Ix i => (a -> e' -> a) -> Arr arr i a -> [(Int, e')] -> Arr arr i a unsafeAccumArray :: Ix i => (a -> e' -> a) -> a -> (i, i) -> [(Int, e')] -> Arr arr i a | |
(Unbox a, Monad m, MArray marr (Unboxed a) m) => MArray (Arr marr) a m Source # | |
Defined in Array getBounds :: Ix i => Arr marr i a -> m (i, i) # getNumElements :: Ix i => Arr marr i a -> m Int newArray :: Ix i => (i, i) -> a -> m (Arr marr i a) # newArray_ :: Ix i => (i, i) -> m (Arr marr i a) # unsafeNewArray_ :: Ix i => (i, i) -> m (Arr marr i a) unsafeRead :: Ix i => Arr marr i a -> Int -> m a unsafeWrite :: Ix i => Arr marr i a -> Int -> a -> m () | |
(IArray (Arr arr) a, Ix i, Show i, Show a) => Show (Arr arr i a) Source # | |
NFData (arr i (Unboxed a)) => NFData (Arr arr i a) Source # | |
data Arr2 arra arrb i ab Source #
Arrays for 2-tuples Primarily intended as a way to get unboxed arrays. If a and b can be put in UArrays, UArr2 i (a,b) works as an unboxed array for (a,b). This is a lot more performant than a boxed Array i (a,b). Also works with mutable arrays, STUArr2 and IOUArr2. Can be nested to get UArr3, UArr4, etc. Use with Unbox and Arr to store your own types.
Instances
(IArray arra a, IArray arrb b) => IArray (Arr2 arra arrb) (a, b) Source # | |
Defined in Array bounds :: Ix i => Arr2 arra arrb i (a, b) -> (i, i) # numElements :: Ix i => Arr2 arra arrb i (a, b) -> Int unsafeArray :: Ix i => (i, i) -> [(Int, (a, b))] -> Arr2 arra arrb i (a, b) unsafeAt :: Ix i => Arr2 arra arrb i (a, b) -> Int -> (a, b) unsafeReplace :: Ix i => Arr2 arra arrb i (a, b) -> [(Int, (a, b))] -> Arr2 arra arrb i (a, b) unsafeAccum :: Ix i => ((a, b) -> e' -> (a, b)) -> Arr2 arra arrb i (a, b) -> [(Int, e')] -> Arr2 arra arrb i (a, b) unsafeAccumArray :: Ix i => ((a, b) -> e' -> (a, b)) -> (a, b) -> (i, i) -> [(Int, e')] -> Arr2 arra arrb i (a, b) | |
(Monad m, MArray marra a m, MArray marrb b m) => MArray (Arr2 marra marrb) (a, b) m Source # | |
Defined in Array getBounds :: Ix i => Arr2 marra marrb i (a, b) -> m (i, i) # getNumElements :: Ix i => Arr2 marra marrb i (a, b) -> m Int newArray :: Ix i => (i, i) -> (a, b) -> m (Arr2 marra marrb i (a, b)) # newArray_ :: Ix i => (i, i) -> m (Arr2 marra marrb i (a, b)) # unsafeNewArray_ :: Ix i => (i, i) -> m (Arr2 marra marrb i (a, b)) unsafeRead :: Ix i => Arr2 marra marrb i (a, b) -> Int -> m (a, b) unsafeWrite :: Ix i => Arr2 marra marrb i (a, b) -> Int -> (a, b) -> m () | |
(IArray (Arr2 arra arrb) ab, Ix i, Show i, Show ab) => Show (Arr2 arra arrb i ab) Source # | |
(NFData (arra i a), NFData (arrb i b)) => NFData (Arr2 arra arrb i (a, b)) Source # | |