Copyright | Copyright (c) 2009-2014, David Sorokin <david.sorokin@gmail.com> |
---|---|
License | BSD3 |
Maintainer | David Sorokin <david.sorokin@gmail.com> |
Stability | experimental |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Tested with: GHC 7.8.3
It defines a prototype of all mutable arrays.
- class ProtoRefMonad m => ProtoArrayMonad m where
- data ProtoArray m :: * -> *
- protoArrayCount :: ProtoArray m a -> m Int
- newProtoArray :: Session m -> Int -> a -> m (ProtoArray m a)
- newProtoArray_ :: Session m -> Int -> m (ProtoArray m a)
- readProtoArray :: ProtoArray m a -> Int -> m a
- writeProtoArray :: ProtoArray m a -> Int -> a -> m ()
- protoArrayToList :: ProtoArray m a -> m [a]
- protoArrayFromList :: [a] -> m (ProtoArray m a)
- freezeProtoArray :: ProtoArray m a -> m (Array Int a)
Documentation
class ProtoRefMonad m => ProtoArrayMonad m where Source
A monad within which computation we can create and work with the prototype of mutable arrays.
data ProtoArray m :: * -> * Source
A prototype of mutable array.
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.