aivika-transformers-2.0: Transformers for the Aivika simulation library

CopyrightCopyright (c) 2009-2014, David Sorokin <david.sorokin@gmail.com>
LicenseBSD3
MaintainerDavid Sorokin <david.sorokin@gmail.com>
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell2010

Simulation.Aivika.Trans.ProtoArray.Unboxed

Description

Tested with: GHC 7.8.3

It defines a prototype of all mutable unboxed arrays.

Synopsis

Documentation

class ProtoRefMonad m => ProtoArrayMonad m a where Source

A monad within which computation we can create and work with the prototype of mutable unboxed arrays.

Associated Types

data ProtoArray m :: * -> * Source

A prototype of mutable unboxed array.

Methods

protoArrayCount :: ProtoArray m a -> m Int Source

Return the array size.

newProtoArray :: Session m -> Int -> a -> m (ProtoArray m a) Source

Create a new ptototype of mutable array by the specified session, size and initial value.

newProtoArray_ :: Session m -> Int -> m (ProtoArray m a) Source

Create a new ptototype of mutable array by the specified session and size with every element initialised to an undefined value.

readProtoArray :: ProtoArray m a -> Int -> m a Source

Read an element from the mutable array.

writeProtoArray :: ProtoArray m a -> Int -> a -> m () Source

Write the element in the mutable array.

protoArrayToList :: ProtoArray m a -> m [a] Source

Return a list of the elements.

protoArrayFromList :: [a] -> m (ProtoArray m a) Source

Create an array by the specified list of elements.

freezeProtoArray :: ProtoArray m a -> m (Array Int a) Source

Return the elements of the mutable array in an immutable array.

Instances