cognimeta-utils-0.1.2: Utilities for Cognimeta products (such as perdure). API may change often.

Safe HaskellNone

Cgm.Data.Array

Synopsis

Documentation

class Array a whereSource

Associated Types

type ArrayElem a :: *Source

Methods

arrayLen :: a -> ArrayIx aSource

Instances

Array a => Array (ArrayRange a) 
Prim w => Array (PrimArray f w) 
Prim w => Array (STPrimArray s f w) 

class Array a => ImmArray a whereSource

Methods

indexArray :: a -> ArrayIx a -> ArrayElem aSource

Instances

class Array a => STArray a Source

Associated Types

type ArrayState a :: *Source

Instances

(Array (ArrayRange a), STArray a) => STArray (ArrayRange a) 
(Array (STPrimArray s f w), Prim w) => STArray (STPrimArray s f w) 

class STArray a => STMkArray a whereSource

STArrays that are instantiable in GCed memory

Methods

mkArray :: ArrayIx a -> ArrayST a aSource

Instances

class STArray a => STZArray a whereSource

STArrays that can be mutated using zero based indexing

Methods

readArray :: a -> ArrayIx a -> ArrayST a (ArrayElem a)Source

writeArray :: a -> ArrayIx a -> ArrayElem a -> ArrayST a ()Source

Instances

class Allocation f whereSource

Methods

newWord8Array :: Len Word8 Word -> ST s (STPrimArray s f Word8)Source

onAllocation :: (f ~ Free => z) -> (f ~ Pinned => z) -> Tagged f zSource

unsafeWithCastArrayByteString :: forall a b. (PinnedArray a, Prim (ArrayElem a)) => (ByteString -> IO b) -> a -> IO bSource

data Free Source

Instances

data PrimArray f w Source

f is either Free or Pinned

Instances

WordConv1 (PrimArray f) 
(Prim w, Eq w) => Eq (PrimArray f w) 
(Prim w, Show w) => Show (PrimArray f w) 
(Array (PrimArray Pinned w), Prim w) => PinnedArray (PrimArray Pinned w) 
(Array (PrimArray f w), Prim w) => ImmArray (PrimArray f w) 
Prim w => Array (PrimArray f w) 

runSTPrimArray :: (forall s. ST s (STPrimArray s f w)) -> PrimArray f wSource

unsafeFreezeSTPrimArray :: STPrimArray s f w -> ST s (PrimArray f w)Source

Safe as long as the input array is not written to after this call. Use the safe runSTPrimArray when possible.

data STPrimArray s f w Source

f is either Free or Pinned

Instances

WordConv1 (STPrimArray s f) 
Eq (STPrimArray s f w) 
(Array (STPrimArray s Pinned w), Prim w) => PinnedArray (STPrimArray s Pinned w) 
(STArray (STPrimArray s f w), Prim w) => STZArray (STPrimArray s f w) 
(STArray (STPrimArray s f w), Allocation f, Prim w) => STMkArray (STPrimArray s f w) 
(Array (STPrimArray s f w), Prim w) => STArray (STPrimArray s f w) 
Prim w => Array (STPrimArray s f w) 

mapMArray :: STZArray a => (ArrayElem a -> ArrayST a (ArrayElem a)) -> a -> ArrayST a ()Source

mapMArrayCopy :: (STZArray a, STZArray b, ArrayState a ~ ArrayState b) => (ArrayElem a -> ArrayST a (ArrayElem b)) -> a -> b -> ArrayST a ()Source

The number of elements copied is the minimum of the number of elements in the source and the number of elements in the destination

mapMArrayCopyImm :: (ImmArray a, STZArray b) => (ArrayElem a -> ArrayST b (ArrayElem b)) -> a -> b -> ArrayST b ()Source

The number of elements copied is the minimum of the number of elements in the source and the number of elements in the destination

mapImmArray :: (Allocation f', Prim b, ImmArray r) => (ArrayElem r -> b) -> r -> PrimArray f' bSource

mkArrayWith :: (Allocation f, Prim a) => Len a Word -> (Len a Word -> a) -> PrimArray f aSource

ioToST :: IO a -> ST RealWorld a

newtype ST s a

The strict state-transformer monad. A computation of type ST s a transforms an internal state indexed by s, and returns a value of type a. The s parameter is either

  • an uninstantiated type variable (inside invocations of runST), or
  • RealWorld (inside invocations of stToIO).

It serves to keep the internal states of different invocations of runST separate from each other and from invocations of stToIO.

The >>= and >> operations are strict in the state (though not in values stored in the state). For example,

runST (writeSTRef _|_ v >>= f) = _|_

Constructors

ST (STRep s a) 

Instances

Typeable2 ST 
Monad (ST s) 
Functor (ST s) 
Functor (ST s) => Applicative (ST s) 
Monad (ST s) => PrimMonad (ST s) 
Show (ST s a)