{-# LANGUAGE
FlexibleInstances
, MultiParamTypeClasses
, RoleAnnotations
#-}
{-# OPTIONS_HADDOCK hide #-}
module Data.Array.IO.Internals (
IOArray(..),
IOUArray(..),
castIOUArray,
unsafeThawIOUArray,
unsafeFreezeIOUArray
) where
import Data.Int
import Data.Word
import Control.Monad.ST ( RealWorld, stToIO )
import Foreign.Ptr ( Ptr, FunPtr )
import Foreign.StablePtr ( StablePtr )
import Data.Array.Base
import GHC.IOArray (IOArray(..))
newtype IOUArray i e = IOUArray (STUArray RealWorld i e)
type role IOUArray nominal nominal
instance Eq (IOUArray i e) where
IOUArray STUArray RealWorld i e
s1 == :: IOUArray i e -> IOUArray i e -> Bool
== IOUArray STUArray RealWorld i e
s2 = STUArray RealWorld i e
s1 STUArray RealWorld i e -> STUArray RealWorld i e -> Bool
forall a. Eq a => a -> a -> Bool
== STUArray RealWorld i e
s2
instance MArray IOUArray Bool IO where
{-# INLINE getBounds #-}
getBounds :: IOUArray i Bool -> IO (i, i)
getBounds (IOUArray STUArray RealWorld i Bool
arr) = ST RealWorld (i, i) -> IO (i, i)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (i, i) -> IO (i, i))
-> ST RealWorld (i, i) -> IO (i, i)
forall a b. (a -> b) -> a -> b
$ STUArray RealWorld i Bool -> ST RealWorld (i, i)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m (i, i)
getBounds STUArray RealWorld i Bool
arr
{-# INLINE getNumElements #-}
getNumElements :: IOUArray i Bool -> IO Int
getNumElements (IOUArray STUArray RealWorld i Bool
arr) = ST RealWorld Int -> IO Int
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld Int -> IO Int) -> ST RealWorld Int -> IO Int
forall a b. (a -> b) -> a -> b
$ STUArray RealWorld i Bool -> ST RealWorld Int
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m Int
getNumElements STUArray RealWorld i Bool
arr
{-# INLINE newArray #-}
newArray :: (i, i) -> Bool -> IO (IOUArray i Bool)
newArray (i, i)
lu Bool
initialValue = ST RealWorld (IOUArray i Bool) -> IO (IOUArray i Bool)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (IOUArray i Bool) -> IO (IOUArray i Bool))
-> ST RealWorld (IOUArray i Bool) -> IO (IOUArray i Bool)
forall a b. (a -> b) -> a -> b
$ do
STUArray RealWorld i Bool
marr <- (i, i) -> Bool -> ST RealWorld (STUArray RealWorld i Bool)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> e -> m (a i e)
newArray (i, i)
lu Bool
initialValue; IOUArray i Bool -> ST RealWorld (IOUArray i Bool)
forall (m :: * -> *) a. Monad m => a -> m a
return (STUArray RealWorld i Bool -> IOUArray i Bool
forall i e. STUArray RealWorld i e -> IOUArray i e
IOUArray STUArray RealWorld i Bool
marr)
{-# INLINE unsafeNewArray_ #-}
unsafeNewArray_ :: (i, i) -> IO (IOUArray i Bool)
unsafeNewArray_ (i, i)
lu = ST RealWorld (IOUArray i Bool) -> IO (IOUArray i Bool)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (IOUArray i Bool) -> IO (IOUArray i Bool))
-> ST RealWorld (IOUArray i Bool) -> IO (IOUArray i Bool)
forall a b. (a -> b) -> a -> b
$ do
STUArray RealWorld i Bool
marr <- (i, i) -> ST RealWorld (STUArray RealWorld i Bool)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_ (i, i)
lu; IOUArray i Bool -> ST RealWorld (IOUArray i Bool)
forall (m :: * -> *) a. Monad m => a -> m a
return (STUArray RealWorld i Bool -> IOUArray i Bool
forall i e. STUArray RealWorld i e -> IOUArray i e
IOUArray STUArray RealWorld i Bool
marr)
{-# INLINE newArray_ #-}
newArray_ :: (i, i) -> IO (IOUArray i Bool)
newArray_ = (i, i) -> IO (IOUArray i Bool)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_
{-# INLINE unsafeRead #-}
unsafeRead :: IOUArray i Bool -> Int -> IO Bool
unsafeRead (IOUArray STUArray RealWorld i Bool
marr) Int
i = ST RealWorld Bool -> IO Bool
forall a. ST RealWorld a -> IO a
stToIO (STUArray RealWorld i Bool -> Int -> ST RealWorld Bool
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> m e
unsafeRead STUArray RealWorld i Bool
marr Int
i)
{-# INLINE unsafeWrite #-}
unsafeWrite :: IOUArray i Bool -> Int -> Bool -> IO ()
unsafeWrite (IOUArray STUArray RealWorld i Bool
marr) Int
i Bool
e = ST RealWorld () -> IO ()
forall a. ST RealWorld a -> IO a
stToIO (STUArray RealWorld i Bool -> Int -> Bool -> ST RealWorld ()
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> e -> m ()
unsafeWrite STUArray RealWorld i Bool
marr Int
i Bool
e)
instance MArray IOUArray Char IO where
{-# INLINE getBounds #-}
getBounds :: IOUArray i Char -> IO (i, i)
getBounds (IOUArray STUArray RealWorld i Char
arr) = ST RealWorld (i, i) -> IO (i, i)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (i, i) -> IO (i, i))
-> ST RealWorld (i, i) -> IO (i, i)
forall a b. (a -> b) -> a -> b
$ STUArray RealWorld i Char -> ST RealWorld (i, i)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m (i, i)
getBounds STUArray RealWorld i Char
arr
{-# INLINE getNumElements #-}
getNumElements :: IOUArray i Char -> IO Int
getNumElements (IOUArray STUArray RealWorld i Char
arr) = ST RealWorld Int -> IO Int
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld Int -> IO Int) -> ST RealWorld Int -> IO Int
forall a b. (a -> b) -> a -> b
$ STUArray RealWorld i Char -> ST RealWorld Int
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m Int
getNumElements STUArray RealWorld i Char
arr
{-# INLINE newArray #-}
newArray :: (i, i) -> Char -> IO (IOUArray i Char)
newArray (i, i)
lu Char
initialValue = ST RealWorld (IOUArray i Char) -> IO (IOUArray i Char)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (IOUArray i Char) -> IO (IOUArray i Char))
-> ST RealWorld (IOUArray i Char) -> IO (IOUArray i Char)
forall a b. (a -> b) -> a -> b
$ do
STUArray RealWorld i Char
marr <- (i, i) -> Char -> ST RealWorld (STUArray RealWorld i Char)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> e -> m (a i e)
newArray (i, i)
lu Char
initialValue; IOUArray i Char -> ST RealWorld (IOUArray i Char)
forall (m :: * -> *) a. Monad m => a -> m a
return (STUArray RealWorld i Char -> IOUArray i Char
forall i e. STUArray RealWorld i e -> IOUArray i e
IOUArray STUArray RealWorld i Char
marr)
{-# INLINE unsafeNewArray_ #-}
unsafeNewArray_ :: (i, i) -> IO (IOUArray i Char)
unsafeNewArray_ (i, i)
lu = ST RealWorld (IOUArray i Char) -> IO (IOUArray i Char)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (IOUArray i Char) -> IO (IOUArray i Char))
-> ST RealWorld (IOUArray i Char) -> IO (IOUArray i Char)
forall a b. (a -> b) -> a -> b
$ do
STUArray RealWorld i Char
marr <- (i, i) -> ST RealWorld (STUArray RealWorld i Char)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_ (i, i)
lu; IOUArray i Char -> ST RealWorld (IOUArray i Char)
forall (m :: * -> *) a. Monad m => a -> m a
return (STUArray RealWorld i Char -> IOUArray i Char
forall i e. STUArray RealWorld i e -> IOUArray i e
IOUArray STUArray RealWorld i Char
marr)
{-# INLINE newArray_ #-}
newArray_ :: (i, i) -> IO (IOUArray i Char)
newArray_ = (i, i) -> IO (IOUArray i Char)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_
{-# INLINE unsafeRead #-}
unsafeRead :: IOUArray i Char -> Int -> IO Char
unsafeRead (IOUArray STUArray RealWorld i Char
marr) Int
i = ST RealWorld Char -> IO Char
forall a. ST RealWorld a -> IO a
stToIO (STUArray RealWorld i Char -> Int -> ST RealWorld Char
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> m e
unsafeRead STUArray RealWorld i Char
marr Int
i)
{-# INLINE unsafeWrite #-}
unsafeWrite :: IOUArray i Char -> Int -> Char -> IO ()
unsafeWrite (IOUArray STUArray RealWorld i Char
marr) Int
i Char
e = ST RealWorld () -> IO ()
forall a. ST RealWorld a -> IO a
stToIO (STUArray RealWorld i Char -> Int -> Char -> ST RealWorld ()
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> e -> m ()
unsafeWrite STUArray RealWorld i Char
marr Int
i Char
e)
instance MArray IOUArray Int IO where
{-# INLINE getBounds #-}
getBounds :: IOUArray i Int -> IO (i, i)
getBounds (IOUArray STUArray RealWorld i Int
arr) = ST RealWorld (i, i) -> IO (i, i)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (i, i) -> IO (i, i))
-> ST RealWorld (i, i) -> IO (i, i)
forall a b. (a -> b) -> a -> b
$ STUArray RealWorld i Int -> ST RealWorld (i, i)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m (i, i)
getBounds STUArray RealWorld i Int
arr
{-# INLINE getNumElements #-}
getNumElements :: IOUArray i Int -> IO Int
getNumElements (IOUArray STUArray RealWorld i Int
arr) = ST RealWorld Int -> IO Int
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld Int -> IO Int) -> ST RealWorld Int -> IO Int
forall a b. (a -> b) -> a -> b
$ STUArray RealWorld i Int -> ST RealWorld Int
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m Int
getNumElements STUArray RealWorld i Int
arr
{-# INLINE newArray #-}
newArray :: (i, i) -> Int -> IO (IOUArray i Int)
newArray (i, i)
lu Int
initialValue = ST RealWorld (IOUArray i Int) -> IO (IOUArray i Int)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (IOUArray i Int) -> IO (IOUArray i Int))
-> ST RealWorld (IOUArray i Int) -> IO (IOUArray i Int)
forall a b. (a -> b) -> a -> b
$ do
STUArray RealWorld i Int
marr <- (i, i) -> Int -> ST RealWorld (STUArray RealWorld i Int)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> e -> m (a i e)
newArray (i, i)
lu Int
initialValue; IOUArray i Int -> ST RealWorld (IOUArray i Int)
forall (m :: * -> *) a. Monad m => a -> m a
return (STUArray RealWorld i Int -> IOUArray i Int
forall i e. STUArray RealWorld i e -> IOUArray i e
IOUArray STUArray RealWorld i Int
marr)
{-# INLINE unsafeNewArray_ #-}
unsafeNewArray_ :: (i, i) -> IO (IOUArray i Int)
unsafeNewArray_ (i, i)
lu = ST RealWorld (IOUArray i Int) -> IO (IOUArray i Int)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (IOUArray i Int) -> IO (IOUArray i Int))
-> ST RealWorld (IOUArray i Int) -> IO (IOUArray i Int)
forall a b. (a -> b) -> a -> b
$ do
STUArray RealWorld i Int
marr <- (i, i) -> ST RealWorld (STUArray RealWorld i Int)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_ (i, i)
lu; IOUArray i Int -> ST RealWorld (IOUArray i Int)
forall (m :: * -> *) a. Monad m => a -> m a
return (STUArray RealWorld i Int -> IOUArray i Int
forall i e. STUArray RealWorld i e -> IOUArray i e
IOUArray STUArray RealWorld i Int
marr)
{-# INLINE newArray_ #-}
newArray_ :: (i, i) -> IO (IOUArray i Int)
newArray_ = (i, i) -> IO (IOUArray i Int)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_
{-# INLINE unsafeRead #-}
unsafeRead :: IOUArray i Int -> Int -> IO Int
unsafeRead (IOUArray STUArray RealWorld i Int
marr) Int
i = ST RealWorld Int -> IO Int
forall a. ST RealWorld a -> IO a
stToIO (STUArray RealWorld i Int -> Int -> ST RealWorld Int
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> m e
unsafeRead STUArray RealWorld i Int
marr Int
i)
{-# INLINE unsafeWrite #-}
unsafeWrite :: IOUArray i Int -> Int -> Int -> IO ()
unsafeWrite (IOUArray STUArray RealWorld i Int
marr) Int
i Int
e = ST RealWorld () -> IO ()
forall a. ST RealWorld a -> IO a
stToIO (STUArray RealWorld i Int -> Int -> Int -> ST RealWorld ()
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> e -> m ()
unsafeWrite STUArray RealWorld i Int
marr Int
i Int
e)
instance MArray IOUArray Word IO where
{-# INLINE getBounds #-}
getBounds :: IOUArray i Word -> IO (i, i)
getBounds (IOUArray STUArray RealWorld i Word
arr) = ST RealWorld (i, i) -> IO (i, i)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (i, i) -> IO (i, i))
-> ST RealWorld (i, i) -> IO (i, i)
forall a b. (a -> b) -> a -> b
$ STUArray RealWorld i Word -> ST RealWorld (i, i)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m (i, i)
getBounds STUArray RealWorld i Word
arr
{-# INLINE getNumElements #-}
getNumElements :: IOUArray i Word -> IO Int
getNumElements (IOUArray STUArray RealWorld i Word
arr) = ST RealWorld Int -> IO Int
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld Int -> IO Int) -> ST RealWorld Int -> IO Int
forall a b. (a -> b) -> a -> b
$ STUArray RealWorld i Word -> ST RealWorld Int
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m Int
getNumElements STUArray RealWorld i Word
arr
{-# INLINE newArray #-}
newArray :: (i, i) -> Word -> IO (IOUArray i Word)
newArray (i, i)
lu Word
initialValue = ST RealWorld (IOUArray i Word) -> IO (IOUArray i Word)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (IOUArray i Word) -> IO (IOUArray i Word))
-> ST RealWorld (IOUArray i Word) -> IO (IOUArray i Word)
forall a b. (a -> b) -> a -> b
$ do
STUArray RealWorld i Word
marr <- (i, i) -> Word -> ST RealWorld (STUArray RealWorld i Word)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> e -> m (a i e)
newArray (i, i)
lu Word
initialValue; IOUArray i Word -> ST RealWorld (IOUArray i Word)
forall (m :: * -> *) a. Monad m => a -> m a
return (STUArray RealWorld i Word -> IOUArray i Word
forall i e. STUArray RealWorld i e -> IOUArray i e
IOUArray STUArray RealWorld i Word
marr)
{-# INLINE unsafeNewArray_ #-}
unsafeNewArray_ :: (i, i) -> IO (IOUArray i Word)
unsafeNewArray_ (i, i)
lu = ST RealWorld (IOUArray i Word) -> IO (IOUArray i Word)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (IOUArray i Word) -> IO (IOUArray i Word))
-> ST RealWorld (IOUArray i Word) -> IO (IOUArray i Word)
forall a b. (a -> b) -> a -> b
$ do
STUArray RealWorld i Word
marr <- (i, i) -> ST RealWorld (STUArray RealWorld i Word)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_ (i, i)
lu; IOUArray i Word -> ST RealWorld (IOUArray i Word)
forall (m :: * -> *) a. Monad m => a -> m a
return (STUArray RealWorld i Word -> IOUArray i Word
forall i e. STUArray RealWorld i e -> IOUArray i e
IOUArray STUArray RealWorld i Word
marr)
{-# INLINE newArray_ #-}
newArray_ :: (i, i) -> IO (IOUArray i Word)
newArray_ = (i, i) -> IO (IOUArray i Word)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_
{-# INLINE unsafeRead #-}
unsafeRead :: IOUArray i Word -> Int -> IO Word
unsafeRead (IOUArray STUArray RealWorld i Word
marr) Int
i = ST RealWorld Word -> IO Word
forall a. ST RealWorld a -> IO a
stToIO (STUArray RealWorld i Word -> Int -> ST RealWorld Word
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> m e
unsafeRead STUArray RealWorld i Word
marr Int
i)
{-# INLINE unsafeWrite #-}
unsafeWrite :: IOUArray i Word -> Int -> Word -> IO ()
unsafeWrite (IOUArray STUArray RealWorld i Word
marr) Int
i Word
e = ST RealWorld () -> IO ()
forall a. ST RealWorld a -> IO a
stToIO (STUArray RealWorld i Word -> Int -> Word -> ST RealWorld ()
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> e -> m ()
unsafeWrite STUArray RealWorld i Word
marr Int
i Word
e)
instance MArray IOUArray (Ptr a) IO where
{-# INLINE getBounds #-}
getBounds :: IOUArray i (Ptr a) -> IO (i, i)
getBounds (IOUArray STUArray RealWorld i (Ptr a)
arr) = ST RealWorld (i, i) -> IO (i, i)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (i, i) -> IO (i, i))
-> ST RealWorld (i, i) -> IO (i, i)
forall a b. (a -> b) -> a -> b
$ STUArray RealWorld i (Ptr a) -> ST RealWorld (i, i)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m (i, i)
getBounds STUArray RealWorld i (Ptr a)
arr
{-# INLINE getNumElements #-}
getNumElements :: IOUArray i (Ptr a) -> IO Int
getNumElements (IOUArray STUArray RealWorld i (Ptr a)
arr) = ST RealWorld Int -> IO Int
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld Int -> IO Int) -> ST RealWorld Int -> IO Int
forall a b. (a -> b) -> a -> b
$ STUArray RealWorld i (Ptr a) -> ST RealWorld Int
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m Int
getNumElements STUArray RealWorld i (Ptr a)
arr
{-# INLINE newArray #-}
newArray :: (i, i) -> Ptr a -> IO (IOUArray i (Ptr a))
newArray (i, i)
lu Ptr a
initialValue = ST RealWorld (IOUArray i (Ptr a)) -> IO (IOUArray i (Ptr a))
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (IOUArray i (Ptr a)) -> IO (IOUArray i (Ptr a)))
-> ST RealWorld (IOUArray i (Ptr a)) -> IO (IOUArray i (Ptr a))
forall a b. (a -> b) -> a -> b
$ do
STUArray RealWorld i (Ptr a)
marr <- (i, i) -> Ptr a -> ST RealWorld (STUArray RealWorld i (Ptr a))
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> e -> m (a i e)
newArray (i, i)
lu Ptr a
initialValue; IOUArray i (Ptr a) -> ST RealWorld (IOUArray i (Ptr a))
forall (m :: * -> *) a. Monad m => a -> m a
return (STUArray RealWorld i (Ptr a) -> IOUArray i (Ptr a)
forall i e. STUArray RealWorld i e -> IOUArray i e
IOUArray STUArray RealWorld i (Ptr a)
marr)
{-# INLINE unsafeNewArray_ #-}
unsafeNewArray_ :: (i, i) -> IO (IOUArray i (Ptr a))
unsafeNewArray_ (i, i)
lu = ST RealWorld (IOUArray i (Ptr a)) -> IO (IOUArray i (Ptr a))
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (IOUArray i (Ptr a)) -> IO (IOUArray i (Ptr a)))
-> ST RealWorld (IOUArray i (Ptr a)) -> IO (IOUArray i (Ptr a))
forall a b. (a -> b) -> a -> b
$ do
STUArray RealWorld i (Ptr a)
marr <- (i, i) -> ST RealWorld (STUArray RealWorld i (Ptr a))
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_ (i, i)
lu; IOUArray i (Ptr a) -> ST RealWorld (IOUArray i (Ptr a))
forall (m :: * -> *) a. Monad m => a -> m a
return (STUArray RealWorld i (Ptr a) -> IOUArray i (Ptr a)
forall i e. STUArray RealWorld i e -> IOUArray i e
IOUArray STUArray RealWorld i (Ptr a)
marr)
{-# INLINE newArray_ #-}
newArray_ :: (i, i) -> IO (IOUArray i (Ptr a))
newArray_ = (i, i) -> IO (IOUArray i (Ptr a))
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_
{-# INLINE unsafeRead #-}
unsafeRead :: IOUArray i (Ptr a) -> Int -> IO (Ptr a)
unsafeRead (IOUArray STUArray RealWorld i (Ptr a)
marr) Int
i = ST RealWorld (Ptr a) -> IO (Ptr a)
forall a. ST RealWorld a -> IO a
stToIO (STUArray RealWorld i (Ptr a) -> Int -> ST RealWorld (Ptr a)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> m e
unsafeRead STUArray RealWorld i (Ptr a)
marr Int
i)
{-# INLINE unsafeWrite #-}
unsafeWrite :: IOUArray i (Ptr a) -> Int -> Ptr a -> IO ()
unsafeWrite (IOUArray STUArray RealWorld i (Ptr a)
marr) Int
i Ptr a
e = ST RealWorld () -> IO ()
forall a. ST RealWorld a -> IO a
stToIO (STUArray RealWorld i (Ptr a) -> Int -> Ptr a -> ST RealWorld ()
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> e -> m ()
unsafeWrite STUArray RealWorld i (Ptr a)
marr Int
i Ptr a
e)
instance MArray IOUArray (FunPtr a) IO where
{-# INLINE getBounds #-}
getBounds :: IOUArray i (FunPtr a) -> IO (i, i)
getBounds (IOUArray STUArray RealWorld i (FunPtr a)
arr) = ST RealWorld (i, i) -> IO (i, i)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (i, i) -> IO (i, i))
-> ST RealWorld (i, i) -> IO (i, i)
forall a b. (a -> b) -> a -> b
$ STUArray RealWorld i (FunPtr a) -> ST RealWorld (i, i)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m (i, i)
getBounds STUArray RealWorld i (FunPtr a)
arr
{-# INLINE getNumElements #-}
getNumElements :: IOUArray i (FunPtr a) -> IO Int
getNumElements (IOUArray STUArray RealWorld i (FunPtr a)
arr) = ST RealWorld Int -> IO Int
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld Int -> IO Int) -> ST RealWorld Int -> IO Int
forall a b. (a -> b) -> a -> b
$ STUArray RealWorld i (FunPtr a) -> ST RealWorld Int
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m Int
getNumElements STUArray RealWorld i (FunPtr a)
arr
{-# INLINE newArray #-}
newArray :: (i, i) -> FunPtr a -> IO (IOUArray i (FunPtr a))
newArray (i, i)
lu FunPtr a
initialValue = ST RealWorld (IOUArray i (FunPtr a)) -> IO (IOUArray i (FunPtr a))
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (IOUArray i (FunPtr a))
-> IO (IOUArray i (FunPtr a)))
-> ST RealWorld (IOUArray i (FunPtr a))
-> IO (IOUArray i (FunPtr a))
forall a b. (a -> b) -> a -> b
$ do
STUArray RealWorld i (FunPtr a)
marr <- (i, i)
-> FunPtr a -> ST RealWorld (STUArray RealWorld i (FunPtr a))
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> e -> m (a i e)
newArray (i, i)
lu FunPtr a
initialValue; IOUArray i (FunPtr a) -> ST RealWorld (IOUArray i (FunPtr a))
forall (m :: * -> *) a. Monad m => a -> m a
return (STUArray RealWorld i (FunPtr a) -> IOUArray i (FunPtr a)
forall i e. STUArray RealWorld i e -> IOUArray i e
IOUArray STUArray RealWorld i (FunPtr a)
marr)
{-# INLINE unsafeNewArray_ #-}
unsafeNewArray_ :: (i, i) -> IO (IOUArray i (FunPtr a))
unsafeNewArray_ (i, i)
lu = ST RealWorld (IOUArray i (FunPtr a)) -> IO (IOUArray i (FunPtr a))
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (IOUArray i (FunPtr a))
-> IO (IOUArray i (FunPtr a)))
-> ST RealWorld (IOUArray i (FunPtr a))
-> IO (IOUArray i (FunPtr a))
forall a b. (a -> b) -> a -> b
$ do
STUArray RealWorld i (FunPtr a)
marr <- (i, i) -> ST RealWorld (STUArray RealWorld i (FunPtr a))
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_ (i, i)
lu; IOUArray i (FunPtr a) -> ST RealWorld (IOUArray i (FunPtr a))
forall (m :: * -> *) a. Monad m => a -> m a
return (STUArray RealWorld i (FunPtr a) -> IOUArray i (FunPtr a)
forall i e. STUArray RealWorld i e -> IOUArray i e
IOUArray STUArray RealWorld i (FunPtr a)
marr)
{-# INLINE newArray_ #-}
newArray_ :: (i, i) -> IO (IOUArray i (FunPtr a))
newArray_ = (i, i) -> IO (IOUArray i (FunPtr a))
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_
{-# INLINE unsafeRead #-}
unsafeRead :: IOUArray i (FunPtr a) -> Int -> IO (FunPtr a)
unsafeRead (IOUArray STUArray RealWorld i (FunPtr a)
marr) Int
i = ST RealWorld (FunPtr a) -> IO (FunPtr a)
forall a. ST RealWorld a -> IO a
stToIO (STUArray RealWorld i (FunPtr a) -> Int -> ST RealWorld (FunPtr a)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> m e
unsafeRead STUArray RealWorld i (FunPtr a)
marr Int
i)
{-# INLINE unsafeWrite #-}
unsafeWrite :: IOUArray i (FunPtr a) -> Int -> FunPtr a -> IO ()
unsafeWrite (IOUArray STUArray RealWorld i (FunPtr a)
marr) Int
i FunPtr a
e = ST RealWorld () -> IO ()
forall a. ST RealWorld a -> IO a
stToIO (STUArray RealWorld i (FunPtr a)
-> Int -> FunPtr a -> ST RealWorld ()
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> e -> m ()
unsafeWrite STUArray RealWorld i (FunPtr a)
marr Int
i FunPtr a
e)
instance MArray IOUArray Float IO where
{-# INLINE getBounds #-}
getBounds :: IOUArray i Float -> IO (i, i)
getBounds (IOUArray STUArray RealWorld i Float
arr) = ST RealWorld (i, i) -> IO (i, i)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (i, i) -> IO (i, i))
-> ST RealWorld (i, i) -> IO (i, i)
forall a b. (a -> b) -> a -> b
$ STUArray RealWorld i Float -> ST RealWorld (i, i)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m (i, i)
getBounds STUArray RealWorld i Float
arr
{-# INLINE getNumElements #-}
getNumElements :: IOUArray i Float -> IO Int
getNumElements (IOUArray STUArray RealWorld i Float
arr) = ST RealWorld Int -> IO Int
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld Int -> IO Int) -> ST RealWorld Int -> IO Int
forall a b. (a -> b) -> a -> b
$ STUArray RealWorld i Float -> ST RealWorld Int
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m Int
getNumElements STUArray RealWorld i Float
arr
{-# INLINE newArray #-}
newArray :: (i, i) -> Float -> IO (IOUArray i Float)
newArray (i, i)
lu Float
initialValue = ST RealWorld (IOUArray i Float) -> IO (IOUArray i Float)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (IOUArray i Float) -> IO (IOUArray i Float))
-> ST RealWorld (IOUArray i Float) -> IO (IOUArray i Float)
forall a b. (a -> b) -> a -> b
$ do
STUArray RealWorld i Float
marr <- (i, i) -> Float -> ST RealWorld (STUArray RealWorld i Float)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> e -> m (a i e)
newArray (i, i)
lu Float
initialValue; IOUArray i Float -> ST RealWorld (IOUArray i Float)
forall (m :: * -> *) a. Monad m => a -> m a
return (STUArray RealWorld i Float -> IOUArray i Float
forall i e. STUArray RealWorld i e -> IOUArray i e
IOUArray STUArray RealWorld i Float
marr)
{-# INLINE unsafeNewArray_ #-}
unsafeNewArray_ :: (i, i) -> IO (IOUArray i Float)
unsafeNewArray_ (i, i)
lu = ST RealWorld (IOUArray i Float) -> IO (IOUArray i Float)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (IOUArray i Float) -> IO (IOUArray i Float))
-> ST RealWorld (IOUArray i Float) -> IO (IOUArray i Float)
forall a b. (a -> b) -> a -> b
$ do
STUArray RealWorld i Float
marr <- (i, i) -> ST RealWorld (STUArray RealWorld i Float)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_ (i, i)
lu; IOUArray i Float -> ST RealWorld (IOUArray i Float)
forall (m :: * -> *) a. Monad m => a -> m a
return (STUArray RealWorld i Float -> IOUArray i Float
forall i e. STUArray RealWorld i e -> IOUArray i e
IOUArray STUArray RealWorld i Float
marr)
{-# INLINE newArray_ #-}
newArray_ :: (i, i) -> IO (IOUArray i Float)
newArray_ = (i, i) -> IO (IOUArray i Float)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_
{-# INLINE unsafeRead #-}
unsafeRead :: IOUArray i Float -> Int -> IO Float
unsafeRead (IOUArray STUArray RealWorld i Float
marr) Int
i = ST RealWorld Float -> IO Float
forall a. ST RealWorld a -> IO a
stToIO (STUArray RealWorld i Float -> Int -> ST RealWorld Float
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> m e
unsafeRead STUArray RealWorld i Float
marr Int
i)
{-# INLINE unsafeWrite #-}
unsafeWrite :: IOUArray i Float -> Int -> Float -> IO ()
unsafeWrite (IOUArray STUArray RealWorld i Float
marr) Int
i Float
e = ST RealWorld () -> IO ()
forall a. ST RealWorld a -> IO a
stToIO (STUArray RealWorld i Float -> Int -> Float -> ST RealWorld ()
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> e -> m ()
unsafeWrite STUArray RealWorld i Float
marr Int
i Float
e)
instance MArray IOUArray Double IO where
{-# INLINE getBounds #-}
getBounds :: IOUArray i Double -> IO (i, i)
getBounds (IOUArray STUArray RealWorld i Double
arr) = ST RealWorld (i, i) -> IO (i, i)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (i, i) -> IO (i, i))
-> ST RealWorld (i, i) -> IO (i, i)
forall a b. (a -> b) -> a -> b
$ STUArray RealWorld i Double -> ST RealWorld (i, i)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m (i, i)
getBounds STUArray RealWorld i Double
arr
{-# INLINE getNumElements #-}
getNumElements :: IOUArray i Double -> IO Int
getNumElements (IOUArray STUArray RealWorld i Double
arr) = ST RealWorld Int -> IO Int
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld Int -> IO Int) -> ST RealWorld Int -> IO Int
forall a b. (a -> b) -> a -> b
$ STUArray RealWorld i Double -> ST RealWorld Int
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m Int
getNumElements STUArray RealWorld i Double
arr
{-# INLINE newArray #-}
newArray :: (i, i) -> Double -> IO (IOUArray i Double)
newArray (i, i)
lu Double
initialValue = ST RealWorld (IOUArray i Double) -> IO (IOUArray i Double)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (IOUArray i Double) -> IO (IOUArray i Double))
-> ST RealWorld (IOUArray i Double) -> IO (IOUArray i Double)
forall a b. (a -> b) -> a -> b
$ do
STUArray RealWorld i Double
marr <- (i, i) -> Double -> ST RealWorld (STUArray RealWorld i Double)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> e -> m (a i e)
newArray (i, i)
lu Double
initialValue; IOUArray i Double -> ST RealWorld (IOUArray i Double)
forall (m :: * -> *) a. Monad m => a -> m a
return (STUArray RealWorld i Double -> IOUArray i Double
forall i e. STUArray RealWorld i e -> IOUArray i e
IOUArray STUArray RealWorld i Double
marr)
{-# INLINE unsafeNewArray_ #-}
unsafeNewArray_ :: (i, i) -> IO (IOUArray i Double)
unsafeNewArray_ (i, i)
lu = ST RealWorld (IOUArray i Double) -> IO (IOUArray i Double)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (IOUArray i Double) -> IO (IOUArray i Double))
-> ST RealWorld (IOUArray i Double) -> IO (IOUArray i Double)
forall a b. (a -> b) -> a -> b
$ do
STUArray RealWorld i Double
marr <- (i, i) -> ST RealWorld (STUArray RealWorld i Double)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_ (i, i)
lu; IOUArray i Double -> ST RealWorld (IOUArray i Double)
forall (m :: * -> *) a. Monad m => a -> m a
return (STUArray RealWorld i Double -> IOUArray i Double
forall i e. STUArray RealWorld i e -> IOUArray i e
IOUArray STUArray RealWorld i Double
marr)
{-# INLINE newArray_ #-}
newArray_ :: (i, i) -> IO (IOUArray i Double)
newArray_ = (i, i) -> IO (IOUArray i Double)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_
{-# INLINE unsafeRead #-}
unsafeRead :: IOUArray i Double -> Int -> IO Double
unsafeRead (IOUArray STUArray RealWorld i Double
marr) Int
i = ST RealWorld Double -> IO Double
forall a. ST RealWorld a -> IO a
stToIO (STUArray RealWorld i Double -> Int -> ST RealWorld Double
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> m e
unsafeRead STUArray RealWorld i Double
marr Int
i)
{-# INLINE unsafeWrite #-}
unsafeWrite :: IOUArray i Double -> Int -> Double -> IO ()
unsafeWrite (IOUArray STUArray RealWorld i Double
marr) Int
i Double
e = ST RealWorld () -> IO ()
forall a. ST RealWorld a -> IO a
stToIO (STUArray RealWorld i Double -> Int -> Double -> ST RealWorld ()
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> e -> m ()
unsafeWrite STUArray RealWorld i Double
marr Int
i Double
e)
instance MArray IOUArray (StablePtr a) IO where
{-# INLINE getBounds #-}
getBounds :: IOUArray i (StablePtr a) -> IO (i, i)
getBounds (IOUArray STUArray RealWorld i (StablePtr a)
arr) = ST RealWorld (i, i) -> IO (i, i)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (i, i) -> IO (i, i))
-> ST RealWorld (i, i) -> IO (i, i)
forall a b. (a -> b) -> a -> b
$ STUArray RealWorld i (StablePtr a) -> ST RealWorld (i, i)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m (i, i)
getBounds STUArray RealWorld i (StablePtr a)
arr
{-# INLINE getNumElements #-}
getNumElements :: IOUArray i (StablePtr a) -> IO Int
getNumElements (IOUArray STUArray RealWorld i (StablePtr a)
arr) = ST RealWorld Int -> IO Int
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld Int -> IO Int) -> ST RealWorld Int -> IO Int
forall a b. (a -> b) -> a -> b
$ STUArray RealWorld i (StablePtr a) -> ST RealWorld Int
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m Int
getNumElements STUArray RealWorld i (StablePtr a)
arr
{-# INLINE newArray #-}
newArray :: (i, i) -> StablePtr a -> IO (IOUArray i (StablePtr a))
newArray (i, i)
lu StablePtr a
initialValue = ST RealWorld (IOUArray i (StablePtr a))
-> IO (IOUArray i (StablePtr a))
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (IOUArray i (StablePtr a))
-> IO (IOUArray i (StablePtr a)))
-> ST RealWorld (IOUArray i (StablePtr a))
-> IO (IOUArray i (StablePtr a))
forall a b. (a -> b) -> a -> b
$ do
STUArray RealWorld i (StablePtr a)
marr <- (i, i)
-> StablePtr a -> ST RealWorld (STUArray RealWorld i (StablePtr a))
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> e -> m (a i e)
newArray (i, i)
lu StablePtr a
initialValue; IOUArray i (StablePtr a) -> ST RealWorld (IOUArray i (StablePtr a))
forall (m :: * -> *) a. Monad m => a -> m a
return (STUArray RealWorld i (StablePtr a) -> IOUArray i (StablePtr a)
forall i e. STUArray RealWorld i e -> IOUArray i e
IOUArray STUArray RealWorld i (StablePtr a)
marr)
{-# INLINE unsafeNewArray_ #-}
unsafeNewArray_ :: (i, i) -> IO (IOUArray i (StablePtr a))
unsafeNewArray_ (i, i)
lu = ST RealWorld (IOUArray i (StablePtr a))
-> IO (IOUArray i (StablePtr a))
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (IOUArray i (StablePtr a))
-> IO (IOUArray i (StablePtr a)))
-> ST RealWorld (IOUArray i (StablePtr a))
-> IO (IOUArray i (StablePtr a))
forall a b. (a -> b) -> a -> b
$ do
STUArray RealWorld i (StablePtr a)
marr <- (i, i) -> ST RealWorld (STUArray RealWorld i (StablePtr a))
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_ (i, i)
lu; IOUArray i (StablePtr a) -> ST RealWorld (IOUArray i (StablePtr a))
forall (m :: * -> *) a. Monad m => a -> m a
return (STUArray RealWorld i (StablePtr a) -> IOUArray i (StablePtr a)
forall i e. STUArray RealWorld i e -> IOUArray i e
IOUArray STUArray RealWorld i (StablePtr a)
marr)
{-# INLINE newArray_ #-}
newArray_ :: (i, i) -> IO (IOUArray i (StablePtr a))
newArray_ = (i, i) -> IO (IOUArray i (StablePtr a))
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_
{-# INLINE unsafeRead #-}
unsafeRead :: IOUArray i (StablePtr a) -> Int -> IO (StablePtr a)
unsafeRead (IOUArray STUArray RealWorld i (StablePtr a)
marr) Int
i = ST RealWorld (StablePtr a) -> IO (StablePtr a)
forall a. ST RealWorld a -> IO a
stToIO (STUArray RealWorld i (StablePtr a)
-> Int -> ST RealWorld (StablePtr a)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> m e
unsafeRead STUArray RealWorld i (StablePtr a)
marr Int
i)
{-# INLINE unsafeWrite #-}
unsafeWrite :: IOUArray i (StablePtr a) -> Int -> StablePtr a -> IO ()
unsafeWrite (IOUArray STUArray RealWorld i (StablePtr a)
marr) Int
i StablePtr a
e = ST RealWorld () -> IO ()
forall a. ST RealWorld a -> IO a
stToIO (STUArray RealWorld i (StablePtr a)
-> Int -> StablePtr a -> ST RealWorld ()
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> e -> m ()
unsafeWrite STUArray RealWorld i (StablePtr a)
marr Int
i StablePtr a
e)
instance MArray IOUArray Int8 IO where
{-# INLINE getBounds #-}
getBounds :: IOUArray i Int8 -> IO (i, i)
getBounds (IOUArray STUArray RealWorld i Int8
arr) = ST RealWorld (i, i) -> IO (i, i)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (i, i) -> IO (i, i))
-> ST RealWorld (i, i) -> IO (i, i)
forall a b. (a -> b) -> a -> b
$ STUArray RealWorld i Int8 -> ST RealWorld (i, i)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m (i, i)
getBounds STUArray RealWorld i Int8
arr
{-# INLINE getNumElements #-}
getNumElements :: IOUArray i Int8 -> IO Int
getNumElements (IOUArray STUArray RealWorld i Int8
arr) = ST RealWorld Int -> IO Int
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld Int -> IO Int) -> ST RealWorld Int -> IO Int
forall a b. (a -> b) -> a -> b
$ STUArray RealWorld i Int8 -> ST RealWorld Int
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m Int
getNumElements STUArray RealWorld i Int8
arr
{-# INLINE newArray #-}
newArray :: (i, i) -> Int8 -> IO (IOUArray i Int8)
newArray (i, i)
lu Int8
initialValue = ST RealWorld (IOUArray i Int8) -> IO (IOUArray i Int8)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (IOUArray i Int8) -> IO (IOUArray i Int8))
-> ST RealWorld (IOUArray i Int8) -> IO (IOUArray i Int8)
forall a b. (a -> b) -> a -> b
$ do
STUArray RealWorld i Int8
marr <- (i, i) -> Int8 -> ST RealWorld (STUArray RealWorld i Int8)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> e -> m (a i e)
newArray (i, i)
lu Int8
initialValue; IOUArray i Int8 -> ST RealWorld (IOUArray i Int8)
forall (m :: * -> *) a. Monad m => a -> m a
return (STUArray RealWorld i Int8 -> IOUArray i Int8
forall i e. STUArray RealWorld i e -> IOUArray i e
IOUArray STUArray RealWorld i Int8
marr)
{-# INLINE unsafeNewArray_ #-}
unsafeNewArray_ :: (i, i) -> IO (IOUArray i Int8)
unsafeNewArray_ (i, i)
lu = ST RealWorld (IOUArray i Int8) -> IO (IOUArray i Int8)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (IOUArray i Int8) -> IO (IOUArray i Int8))
-> ST RealWorld (IOUArray i Int8) -> IO (IOUArray i Int8)
forall a b. (a -> b) -> a -> b
$ do
STUArray RealWorld i Int8
marr <- (i, i) -> ST RealWorld (STUArray RealWorld i Int8)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_ (i, i)
lu; IOUArray i Int8 -> ST RealWorld (IOUArray i Int8)
forall (m :: * -> *) a. Monad m => a -> m a
return (STUArray RealWorld i Int8 -> IOUArray i Int8
forall i e. STUArray RealWorld i e -> IOUArray i e
IOUArray STUArray RealWorld i Int8
marr)
{-# INLINE newArray_ #-}
newArray_ :: (i, i) -> IO (IOUArray i Int8)
newArray_ = (i, i) -> IO (IOUArray i Int8)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_
{-# INLINE unsafeRead #-}
unsafeRead :: IOUArray i Int8 -> Int -> IO Int8
unsafeRead (IOUArray STUArray RealWorld i Int8
marr) Int
i = ST RealWorld Int8 -> IO Int8
forall a. ST RealWorld a -> IO a
stToIO (STUArray RealWorld i Int8 -> Int -> ST RealWorld Int8
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> m e
unsafeRead STUArray RealWorld i Int8
marr Int
i)
{-# INLINE unsafeWrite #-}
unsafeWrite :: IOUArray i Int8 -> Int -> Int8 -> IO ()
unsafeWrite (IOUArray STUArray RealWorld i Int8
marr) Int
i Int8
e = ST RealWorld () -> IO ()
forall a. ST RealWorld a -> IO a
stToIO (STUArray RealWorld i Int8 -> Int -> Int8 -> ST RealWorld ()
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> e -> m ()
unsafeWrite STUArray RealWorld i Int8
marr Int
i Int8
e)
instance MArray IOUArray Int16 IO where
{-# INLINE getBounds #-}
getBounds :: IOUArray i Int16 -> IO (i, i)
getBounds (IOUArray STUArray RealWorld i Int16
arr) = ST RealWorld (i, i) -> IO (i, i)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (i, i) -> IO (i, i))
-> ST RealWorld (i, i) -> IO (i, i)
forall a b. (a -> b) -> a -> b
$ STUArray RealWorld i Int16 -> ST RealWorld (i, i)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m (i, i)
getBounds STUArray RealWorld i Int16
arr
{-# INLINE getNumElements #-}
getNumElements :: IOUArray i Int16 -> IO Int
getNumElements (IOUArray STUArray RealWorld i Int16
arr) = ST RealWorld Int -> IO Int
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld Int -> IO Int) -> ST RealWorld Int -> IO Int
forall a b. (a -> b) -> a -> b
$ STUArray RealWorld i Int16 -> ST RealWorld Int
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m Int
getNumElements STUArray RealWorld i Int16
arr
{-# INLINE newArray #-}
newArray :: (i, i) -> Int16 -> IO (IOUArray i Int16)
newArray (i, i)
lu Int16
initialValue = ST RealWorld (IOUArray i Int16) -> IO (IOUArray i Int16)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (IOUArray i Int16) -> IO (IOUArray i Int16))
-> ST RealWorld (IOUArray i Int16) -> IO (IOUArray i Int16)
forall a b. (a -> b) -> a -> b
$ do
STUArray RealWorld i Int16
marr <- (i, i) -> Int16 -> ST RealWorld (STUArray RealWorld i Int16)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> e -> m (a i e)
newArray (i, i)
lu Int16
initialValue; IOUArray i Int16 -> ST RealWorld (IOUArray i Int16)
forall (m :: * -> *) a. Monad m => a -> m a
return (STUArray RealWorld i Int16 -> IOUArray i Int16
forall i e. STUArray RealWorld i e -> IOUArray i e
IOUArray STUArray RealWorld i Int16
marr)
{-# INLINE unsafeNewArray_ #-}
unsafeNewArray_ :: (i, i) -> IO (IOUArray i Int16)
unsafeNewArray_ (i, i)
lu = ST RealWorld (IOUArray i Int16) -> IO (IOUArray i Int16)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (IOUArray i Int16) -> IO (IOUArray i Int16))
-> ST RealWorld (IOUArray i Int16) -> IO (IOUArray i Int16)
forall a b. (a -> b) -> a -> b
$ do
STUArray RealWorld i Int16
marr <- (i, i) -> ST RealWorld (STUArray RealWorld i Int16)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_ (i, i)
lu; IOUArray i Int16 -> ST RealWorld (IOUArray i Int16)
forall (m :: * -> *) a. Monad m => a -> m a
return (STUArray RealWorld i Int16 -> IOUArray i Int16
forall i e. STUArray RealWorld i e -> IOUArray i e
IOUArray STUArray RealWorld i Int16
marr)
{-# INLINE newArray_ #-}
newArray_ :: (i, i) -> IO (IOUArray i Int16)
newArray_ = (i, i) -> IO (IOUArray i Int16)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_
{-# INLINE unsafeRead #-}
unsafeRead :: IOUArray i Int16 -> Int -> IO Int16
unsafeRead (IOUArray STUArray RealWorld i Int16
marr) Int
i = ST RealWorld Int16 -> IO Int16
forall a. ST RealWorld a -> IO a
stToIO (STUArray RealWorld i Int16 -> Int -> ST RealWorld Int16
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> m e
unsafeRead STUArray RealWorld i Int16
marr Int
i)
{-# INLINE unsafeWrite #-}
unsafeWrite :: IOUArray i Int16 -> Int -> Int16 -> IO ()
unsafeWrite (IOUArray STUArray RealWorld i Int16
marr) Int
i Int16
e = ST RealWorld () -> IO ()
forall a. ST RealWorld a -> IO a
stToIO (STUArray RealWorld i Int16 -> Int -> Int16 -> ST RealWorld ()
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> e -> m ()
unsafeWrite STUArray RealWorld i Int16
marr Int
i Int16
e)
instance MArray IOUArray Int32 IO where
{-# INLINE getBounds #-}
getBounds :: IOUArray i Int32 -> IO (i, i)
getBounds (IOUArray STUArray RealWorld i Int32
arr) = ST RealWorld (i, i) -> IO (i, i)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (i, i) -> IO (i, i))
-> ST RealWorld (i, i) -> IO (i, i)
forall a b. (a -> b) -> a -> b
$ STUArray RealWorld i Int32 -> ST RealWorld (i, i)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m (i, i)
getBounds STUArray RealWorld i Int32
arr
{-# INLINE getNumElements #-}
getNumElements :: IOUArray i Int32 -> IO Int
getNumElements (IOUArray STUArray RealWorld i Int32
arr) = ST RealWorld Int -> IO Int
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld Int -> IO Int) -> ST RealWorld Int -> IO Int
forall a b. (a -> b) -> a -> b
$ STUArray RealWorld i Int32 -> ST RealWorld Int
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m Int
getNumElements STUArray RealWorld i Int32
arr
{-# INLINE newArray #-}
newArray :: (i, i) -> Int32 -> IO (IOUArray i Int32)
newArray (i, i)
lu Int32
initialValue = ST RealWorld (IOUArray i Int32) -> IO (IOUArray i Int32)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (IOUArray i Int32) -> IO (IOUArray i Int32))
-> ST RealWorld (IOUArray i Int32) -> IO (IOUArray i Int32)
forall a b. (a -> b) -> a -> b
$ do
STUArray RealWorld i Int32
marr <- (i, i) -> Int32 -> ST RealWorld (STUArray RealWorld i Int32)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> e -> m (a i e)
newArray (i, i)
lu Int32
initialValue; IOUArray i Int32 -> ST RealWorld (IOUArray i Int32)
forall (m :: * -> *) a. Monad m => a -> m a
return (STUArray RealWorld i Int32 -> IOUArray i Int32
forall i e. STUArray RealWorld i e -> IOUArray i e
IOUArray STUArray RealWorld i Int32
marr)
{-# INLINE unsafeNewArray_ #-}
unsafeNewArray_ :: (i, i) -> IO (IOUArray i Int32)
unsafeNewArray_ (i, i)
lu = ST RealWorld (IOUArray i Int32) -> IO (IOUArray i Int32)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (IOUArray i Int32) -> IO (IOUArray i Int32))
-> ST RealWorld (IOUArray i Int32) -> IO (IOUArray i Int32)
forall a b. (a -> b) -> a -> b
$ do
STUArray RealWorld i Int32
marr <- (i, i) -> ST RealWorld (STUArray RealWorld i Int32)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_ (i, i)
lu; IOUArray i Int32 -> ST RealWorld (IOUArray i Int32)
forall (m :: * -> *) a. Monad m => a -> m a
return (STUArray RealWorld i Int32 -> IOUArray i Int32
forall i e. STUArray RealWorld i e -> IOUArray i e
IOUArray STUArray RealWorld i Int32
marr)
{-# INLINE newArray_ #-}
newArray_ :: (i, i) -> IO (IOUArray i Int32)
newArray_ = (i, i) -> IO (IOUArray i Int32)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_
{-# INLINE unsafeRead #-}
unsafeRead :: IOUArray i Int32 -> Int -> IO Int32
unsafeRead (IOUArray STUArray RealWorld i Int32
marr) Int
i = ST RealWorld Int32 -> IO Int32
forall a. ST RealWorld a -> IO a
stToIO (STUArray RealWorld i Int32 -> Int -> ST RealWorld Int32
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> m e
unsafeRead STUArray RealWorld i Int32
marr Int
i)
{-# INLINE unsafeWrite #-}
unsafeWrite :: IOUArray i Int32 -> Int -> Int32 -> IO ()
unsafeWrite (IOUArray STUArray RealWorld i Int32
marr) Int
i Int32
e = ST RealWorld () -> IO ()
forall a. ST RealWorld a -> IO a
stToIO (STUArray RealWorld i Int32 -> Int -> Int32 -> ST RealWorld ()
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> e -> m ()
unsafeWrite STUArray RealWorld i Int32
marr Int
i Int32
e)
instance MArray IOUArray Int64 IO where
{-# INLINE getBounds #-}
getBounds :: IOUArray i Int64 -> IO (i, i)
getBounds (IOUArray STUArray RealWorld i Int64
arr) = ST RealWorld (i, i) -> IO (i, i)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (i, i) -> IO (i, i))
-> ST RealWorld (i, i) -> IO (i, i)
forall a b. (a -> b) -> a -> b
$ STUArray RealWorld i Int64 -> ST RealWorld (i, i)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m (i, i)
getBounds STUArray RealWorld i Int64
arr
{-# INLINE getNumElements #-}
getNumElements :: IOUArray i Int64 -> IO Int
getNumElements (IOUArray STUArray RealWorld i Int64
arr) = ST RealWorld Int -> IO Int
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld Int -> IO Int) -> ST RealWorld Int -> IO Int
forall a b. (a -> b) -> a -> b
$ STUArray RealWorld i Int64 -> ST RealWorld Int
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m Int
getNumElements STUArray RealWorld i Int64
arr
{-# INLINE newArray #-}
newArray :: (i, i) -> Int64 -> IO (IOUArray i Int64)
newArray (i, i)
lu Int64
initialValue = ST RealWorld (IOUArray i Int64) -> IO (IOUArray i Int64)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (IOUArray i Int64) -> IO (IOUArray i Int64))
-> ST RealWorld (IOUArray i Int64) -> IO (IOUArray i Int64)
forall a b. (a -> b) -> a -> b
$ do
STUArray RealWorld i Int64
marr <- (i, i) -> Int64 -> ST RealWorld (STUArray RealWorld i Int64)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> e -> m (a i e)
newArray (i, i)
lu Int64
initialValue; IOUArray i Int64 -> ST RealWorld (IOUArray i Int64)
forall (m :: * -> *) a. Monad m => a -> m a
return (STUArray RealWorld i Int64 -> IOUArray i Int64
forall i e. STUArray RealWorld i e -> IOUArray i e
IOUArray STUArray RealWorld i Int64
marr)
{-# INLINE unsafeNewArray_ #-}
unsafeNewArray_ :: (i, i) -> IO (IOUArray i Int64)
unsafeNewArray_ (i, i)
lu = ST RealWorld (IOUArray i Int64) -> IO (IOUArray i Int64)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (IOUArray i Int64) -> IO (IOUArray i Int64))
-> ST RealWorld (IOUArray i Int64) -> IO (IOUArray i Int64)
forall a b. (a -> b) -> a -> b
$ do
STUArray RealWorld i Int64
marr <- (i, i) -> ST RealWorld (STUArray RealWorld i Int64)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_ (i, i)
lu; IOUArray i Int64 -> ST RealWorld (IOUArray i Int64)
forall (m :: * -> *) a. Monad m => a -> m a
return (STUArray RealWorld i Int64 -> IOUArray i Int64
forall i e. STUArray RealWorld i e -> IOUArray i e
IOUArray STUArray RealWorld i Int64
marr)
{-# INLINE newArray_ #-}
newArray_ :: (i, i) -> IO (IOUArray i Int64)
newArray_ = (i, i) -> IO (IOUArray i Int64)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_
{-# INLINE unsafeRead #-}
unsafeRead :: IOUArray i Int64 -> Int -> IO Int64
unsafeRead (IOUArray STUArray RealWorld i Int64
marr) Int
i = ST RealWorld Int64 -> IO Int64
forall a. ST RealWorld a -> IO a
stToIO (STUArray RealWorld i Int64 -> Int -> ST RealWorld Int64
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> m e
unsafeRead STUArray RealWorld i Int64
marr Int
i)
{-# INLINE unsafeWrite #-}
unsafeWrite :: IOUArray i Int64 -> Int -> Int64 -> IO ()
unsafeWrite (IOUArray STUArray RealWorld i Int64
marr) Int
i Int64
e = ST RealWorld () -> IO ()
forall a. ST RealWorld a -> IO a
stToIO (STUArray RealWorld i Int64 -> Int -> Int64 -> ST RealWorld ()
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> e -> m ()
unsafeWrite STUArray RealWorld i Int64
marr Int
i Int64
e)
instance MArray IOUArray Word8 IO where
{-# INLINE getBounds #-}
getBounds :: IOUArray i Word8 -> IO (i, i)
getBounds (IOUArray STUArray RealWorld i Word8
arr) = ST RealWorld (i, i) -> IO (i, i)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (i, i) -> IO (i, i))
-> ST RealWorld (i, i) -> IO (i, i)
forall a b. (a -> b) -> a -> b
$ STUArray RealWorld i Word8 -> ST RealWorld (i, i)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m (i, i)
getBounds STUArray RealWorld i Word8
arr
{-# INLINE getNumElements #-}
getNumElements :: IOUArray i Word8 -> IO Int
getNumElements (IOUArray STUArray RealWorld i Word8
arr) = ST RealWorld Int -> IO Int
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld Int -> IO Int) -> ST RealWorld Int -> IO Int
forall a b. (a -> b) -> a -> b
$ STUArray RealWorld i Word8 -> ST RealWorld Int
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m Int
getNumElements STUArray RealWorld i Word8
arr
{-# INLINE newArray #-}
newArray :: (i, i) -> Word8 -> IO (IOUArray i Word8)
newArray (i, i)
lu Word8
initialValue = ST RealWorld (IOUArray i Word8) -> IO (IOUArray i Word8)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (IOUArray i Word8) -> IO (IOUArray i Word8))
-> ST RealWorld (IOUArray i Word8) -> IO (IOUArray i Word8)
forall a b. (a -> b) -> a -> b
$ do
STUArray RealWorld i Word8
marr <- (i, i) -> Word8 -> ST RealWorld (STUArray RealWorld i Word8)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> e -> m (a i e)
newArray (i, i)
lu Word8
initialValue; IOUArray i Word8 -> ST RealWorld (IOUArray i Word8)
forall (m :: * -> *) a. Monad m => a -> m a
return (STUArray RealWorld i Word8 -> IOUArray i Word8
forall i e. STUArray RealWorld i e -> IOUArray i e
IOUArray STUArray RealWorld i Word8
marr)
{-# INLINE unsafeNewArray_ #-}
unsafeNewArray_ :: (i, i) -> IO (IOUArray i Word8)
unsafeNewArray_ (i, i)
lu = ST RealWorld (IOUArray i Word8) -> IO (IOUArray i Word8)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (IOUArray i Word8) -> IO (IOUArray i Word8))
-> ST RealWorld (IOUArray i Word8) -> IO (IOUArray i Word8)
forall a b. (a -> b) -> a -> b
$ do
STUArray RealWorld i Word8
marr <- (i, i) -> ST RealWorld (STUArray RealWorld i Word8)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_ (i, i)
lu; IOUArray i Word8 -> ST RealWorld (IOUArray i Word8)
forall (m :: * -> *) a. Monad m => a -> m a
return (STUArray RealWorld i Word8 -> IOUArray i Word8
forall i e. STUArray RealWorld i e -> IOUArray i e
IOUArray STUArray RealWorld i Word8
marr)
{-# INLINE newArray_ #-}
newArray_ :: (i, i) -> IO (IOUArray i Word8)
newArray_ = (i, i) -> IO (IOUArray i Word8)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_
{-# INLINE unsafeRead #-}
unsafeRead :: IOUArray i Word8 -> Int -> IO Word8
unsafeRead (IOUArray STUArray RealWorld i Word8
marr) Int
i = ST RealWorld Word8 -> IO Word8
forall a. ST RealWorld a -> IO a
stToIO (STUArray RealWorld i Word8 -> Int -> ST RealWorld Word8
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> m e
unsafeRead STUArray RealWorld i Word8
marr Int
i)
{-# INLINE unsafeWrite #-}
unsafeWrite :: IOUArray i Word8 -> Int -> Word8 -> IO ()
unsafeWrite (IOUArray STUArray RealWorld i Word8
marr) Int
i Word8
e = ST RealWorld () -> IO ()
forall a. ST RealWorld a -> IO a
stToIO (STUArray RealWorld i Word8 -> Int -> Word8 -> ST RealWorld ()
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> e -> m ()
unsafeWrite STUArray RealWorld i Word8
marr Int
i Word8
e)
instance MArray IOUArray Word16 IO where
{-# INLINE getBounds #-}
getBounds :: IOUArray i Word16 -> IO (i, i)
getBounds (IOUArray STUArray RealWorld i Word16
arr) = ST RealWorld (i, i) -> IO (i, i)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (i, i) -> IO (i, i))
-> ST RealWorld (i, i) -> IO (i, i)
forall a b. (a -> b) -> a -> b
$ STUArray RealWorld i Word16 -> ST RealWorld (i, i)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m (i, i)
getBounds STUArray RealWorld i Word16
arr
{-# INLINE getNumElements #-}
getNumElements :: IOUArray i Word16 -> IO Int
getNumElements (IOUArray STUArray RealWorld i Word16
arr) = ST RealWorld Int -> IO Int
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld Int -> IO Int) -> ST RealWorld Int -> IO Int
forall a b. (a -> b) -> a -> b
$ STUArray RealWorld i Word16 -> ST RealWorld Int
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m Int
getNumElements STUArray RealWorld i Word16
arr
{-# INLINE newArray #-}
newArray :: (i, i) -> Word16 -> IO (IOUArray i Word16)
newArray (i, i)
lu Word16
initialValue = ST RealWorld (IOUArray i Word16) -> IO (IOUArray i Word16)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (IOUArray i Word16) -> IO (IOUArray i Word16))
-> ST RealWorld (IOUArray i Word16) -> IO (IOUArray i Word16)
forall a b. (a -> b) -> a -> b
$ do
STUArray RealWorld i Word16
marr <- (i, i) -> Word16 -> ST RealWorld (STUArray RealWorld i Word16)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> e -> m (a i e)
newArray (i, i)
lu Word16
initialValue; IOUArray i Word16 -> ST RealWorld (IOUArray i Word16)
forall (m :: * -> *) a. Monad m => a -> m a
return (STUArray RealWorld i Word16 -> IOUArray i Word16
forall i e. STUArray RealWorld i e -> IOUArray i e
IOUArray STUArray RealWorld i Word16
marr)
{-# INLINE unsafeNewArray_ #-}
unsafeNewArray_ :: (i, i) -> IO (IOUArray i Word16)
unsafeNewArray_ (i, i)
lu = ST RealWorld (IOUArray i Word16) -> IO (IOUArray i Word16)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (IOUArray i Word16) -> IO (IOUArray i Word16))
-> ST RealWorld (IOUArray i Word16) -> IO (IOUArray i Word16)
forall a b. (a -> b) -> a -> b
$ do
STUArray RealWorld i Word16
marr <- (i, i) -> ST RealWorld (STUArray RealWorld i Word16)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_ (i, i)
lu; IOUArray i Word16 -> ST RealWorld (IOUArray i Word16)
forall (m :: * -> *) a. Monad m => a -> m a
return (STUArray RealWorld i Word16 -> IOUArray i Word16
forall i e. STUArray RealWorld i e -> IOUArray i e
IOUArray STUArray RealWorld i Word16
marr)
{-# INLINE newArray_ #-}
newArray_ :: (i, i) -> IO (IOUArray i Word16)
newArray_ = (i, i) -> IO (IOUArray i Word16)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_
{-# INLINE unsafeRead #-}
unsafeRead :: IOUArray i Word16 -> Int -> IO Word16
unsafeRead (IOUArray STUArray RealWorld i Word16
marr) Int
i = ST RealWorld Word16 -> IO Word16
forall a. ST RealWorld a -> IO a
stToIO (STUArray RealWorld i Word16 -> Int -> ST RealWorld Word16
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> m e
unsafeRead STUArray RealWorld i Word16
marr Int
i)
{-# INLINE unsafeWrite #-}
unsafeWrite :: IOUArray i Word16 -> Int -> Word16 -> IO ()
unsafeWrite (IOUArray STUArray RealWorld i Word16
marr) Int
i Word16
e = ST RealWorld () -> IO ()
forall a. ST RealWorld a -> IO a
stToIO (STUArray RealWorld i Word16 -> Int -> Word16 -> ST RealWorld ()
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> e -> m ()
unsafeWrite STUArray RealWorld i Word16
marr Int
i Word16
e)
instance MArray IOUArray Word32 IO where
{-# INLINE getBounds #-}
getBounds :: IOUArray i Word32 -> IO (i, i)
getBounds (IOUArray STUArray RealWorld i Word32
arr) = ST RealWorld (i, i) -> IO (i, i)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (i, i) -> IO (i, i))
-> ST RealWorld (i, i) -> IO (i, i)
forall a b. (a -> b) -> a -> b
$ STUArray RealWorld i Word32 -> ST RealWorld (i, i)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m (i, i)
getBounds STUArray RealWorld i Word32
arr
{-# INLINE getNumElements #-}
getNumElements :: IOUArray i Word32 -> IO Int
getNumElements (IOUArray STUArray RealWorld i Word32
arr) = ST RealWorld Int -> IO Int
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld Int -> IO Int) -> ST RealWorld Int -> IO Int
forall a b. (a -> b) -> a -> b
$ STUArray RealWorld i Word32 -> ST RealWorld Int
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m Int
getNumElements STUArray RealWorld i Word32
arr
{-# INLINE newArray #-}
newArray :: (i, i) -> Word32 -> IO (IOUArray i Word32)
newArray (i, i)
lu Word32
initialValue = ST RealWorld (IOUArray i Word32) -> IO (IOUArray i Word32)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (IOUArray i Word32) -> IO (IOUArray i Word32))
-> ST RealWorld (IOUArray i Word32) -> IO (IOUArray i Word32)
forall a b. (a -> b) -> a -> b
$ do
STUArray RealWorld i Word32
marr <- (i, i) -> Word32 -> ST RealWorld (STUArray RealWorld i Word32)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> e -> m (a i e)
newArray (i, i)
lu Word32
initialValue; IOUArray i Word32 -> ST RealWorld (IOUArray i Word32)
forall (m :: * -> *) a. Monad m => a -> m a
return (STUArray RealWorld i Word32 -> IOUArray i Word32
forall i e. STUArray RealWorld i e -> IOUArray i e
IOUArray STUArray RealWorld i Word32
marr)
{-# INLINE unsafeNewArray_ #-}
unsafeNewArray_ :: (i, i) -> IO (IOUArray i Word32)
unsafeNewArray_ (i, i)
lu = ST RealWorld (IOUArray i Word32) -> IO (IOUArray i Word32)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (IOUArray i Word32) -> IO (IOUArray i Word32))
-> ST RealWorld (IOUArray i Word32) -> IO (IOUArray i Word32)
forall a b. (a -> b) -> a -> b
$ do
STUArray RealWorld i Word32
marr <- (i, i) -> ST RealWorld (STUArray RealWorld i Word32)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_ (i, i)
lu; IOUArray i Word32 -> ST RealWorld (IOUArray i Word32)
forall (m :: * -> *) a. Monad m => a -> m a
return (STUArray RealWorld i Word32 -> IOUArray i Word32
forall i e. STUArray RealWorld i e -> IOUArray i e
IOUArray STUArray RealWorld i Word32
marr)
{-# INLINE newArray_ #-}
newArray_ :: (i, i) -> IO (IOUArray i Word32)
newArray_ = (i, i) -> IO (IOUArray i Word32)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_
{-# INLINE unsafeRead #-}
unsafeRead :: IOUArray i Word32 -> Int -> IO Word32
unsafeRead (IOUArray STUArray RealWorld i Word32
marr) Int
i = ST RealWorld Word32 -> IO Word32
forall a. ST RealWorld a -> IO a
stToIO (STUArray RealWorld i Word32 -> Int -> ST RealWorld Word32
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> m e
unsafeRead STUArray RealWorld i Word32
marr Int
i)
{-# INLINE unsafeWrite #-}
unsafeWrite :: IOUArray i Word32 -> Int -> Word32 -> IO ()
unsafeWrite (IOUArray STUArray RealWorld i Word32
marr) Int
i Word32
e = ST RealWorld () -> IO ()
forall a. ST RealWorld a -> IO a
stToIO (STUArray RealWorld i Word32 -> Int -> Word32 -> ST RealWorld ()
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> e -> m ()
unsafeWrite STUArray RealWorld i Word32
marr Int
i Word32
e)
instance MArray IOUArray Word64 IO where
{-# INLINE getBounds #-}
getBounds :: IOUArray i Word64 -> IO (i, i)
getBounds (IOUArray STUArray RealWorld i Word64
arr) = ST RealWorld (i, i) -> IO (i, i)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (i, i) -> IO (i, i))
-> ST RealWorld (i, i) -> IO (i, i)
forall a b. (a -> b) -> a -> b
$ STUArray RealWorld i Word64 -> ST RealWorld (i, i)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m (i, i)
getBounds STUArray RealWorld i Word64
arr
{-# INLINE getNumElements #-}
getNumElements :: IOUArray i Word64 -> IO Int
getNumElements (IOUArray STUArray RealWorld i Word64
arr) = ST RealWorld Int -> IO Int
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld Int -> IO Int) -> ST RealWorld Int -> IO Int
forall a b. (a -> b) -> a -> b
$ STUArray RealWorld i Word64 -> ST RealWorld Int
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m Int
getNumElements STUArray RealWorld i Word64
arr
{-# INLINE newArray #-}
newArray :: (i, i) -> Word64 -> IO (IOUArray i Word64)
newArray (i, i)
lu Word64
initialValue = ST RealWorld (IOUArray i Word64) -> IO (IOUArray i Word64)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (IOUArray i Word64) -> IO (IOUArray i Word64))
-> ST RealWorld (IOUArray i Word64) -> IO (IOUArray i Word64)
forall a b. (a -> b) -> a -> b
$ do
STUArray RealWorld i Word64
marr <- (i, i) -> Word64 -> ST RealWorld (STUArray RealWorld i Word64)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> e -> m (a i e)
newArray (i, i)
lu Word64
initialValue; IOUArray i Word64 -> ST RealWorld (IOUArray i Word64)
forall (m :: * -> *) a. Monad m => a -> m a
return (STUArray RealWorld i Word64 -> IOUArray i Word64
forall i e. STUArray RealWorld i e -> IOUArray i e
IOUArray STUArray RealWorld i Word64
marr)
{-# INLINE unsafeNewArray_ #-}
unsafeNewArray_ :: (i, i) -> IO (IOUArray i Word64)
unsafeNewArray_ (i, i)
lu = ST RealWorld (IOUArray i Word64) -> IO (IOUArray i Word64)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (IOUArray i Word64) -> IO (IOUArray i Word64))
-> ST RealWorld (IOUArray i Word64) -> IO (IOUArray i Word64)
forall a b. (a -> b) -> a -> b
$ do
STUArray RealWorld i Word64
marr <- (i, i) -> ST RealWorld (STUArray RealWorld i Word64)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_ (i, i)
lu; IOUArray i Word64 -> ST RealWorld (IOUArray i Word64)
forall (m :: * -> *) a. Monad m => a -> m a
return (STUArray RealWorld i Word64 -> IOUArray i Word64
forall i e. STUArray RealWorld i e -> IOUArray i e
IOUArray STUArray RealWorld i Word64
marr)
{-# INLINE newArray_ #-}
newArray_ :: (i, i) -> IO (IOUArray i Word64)
newArray_ = (i, i) -> IO (IOUArray i Word64)
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_
{-# INLINE unsafeRead #-}
unsafeRead :: IOUArray i Word64 -> Int -> IO Word64
unsafeRead (IOUArray STUArray RealWorld i Word64
marr) Int
i = ST RealWorld Word64 -> IO Word64
forall a. ST RealWorld a -> IO a
stToIO (STUArray RealWorld i Word64 -> Int -> ST RealWorld Word64
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> m e
unsafeRead STUArray RealWorld i Word64
marr Int
i)
{-# INLINE unsafeWrite #-}
unsafeWrite :: IOUArray i Word64 -> Int -> Word64 -> IO ()
unsafeWrite (IOUArray STUArray RealWorld i Word64
marr) Int
i Word64
e = ST RealWorld () -> IO ()
forall a. ST RealWorld a -> IO a
stToIO (STUArray RealWorld i Word64 -> Int -> Word64 -> ST RealWorld ()
forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> e -> m ()
unsafeWrite STUArray RealWorld i Word64
marr Int
i Word64
e)
castIOUArray :: IOUArray ix a -> IO (IOUArray ix b)
castIOUArray :: IOUArray ix a -> IO (IOUArray ix b)
castIOUArray (IOUArray STUArray RealWorld ix a
marr) = ST RealWorld (IOUArray ix b) -> IO (IOUArray ix b)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (IOUArray ix b) -> IO (IOUArray ix b))
-> ST RealWorld (IOUArray ix b) -> IO (IOUArray ix b)
forall a b. (a -> b) -> a -> b
$ do
STUArray RealWorld ix b
marr' <- STUArray RealWorld ix a -> ST RealWorld (STUArray RealWorld ix b)
forall s ix a b. STUArray s ix a -> ST s (STUArray s ix b)
castSTUArray STUArray RealWorld ix a
marr
IOUArray ix b -> ST RealWorld (IOUArray ix b)
forall (m :: * -> *) a. Monad m => a -> m a
return (STUArray RealWorld ix b -> IOUArray ix b
forall i e. STUArray RealWorld i e -> IOUArray i e
IOUArray STUArray RealWorld ix b
marr')
{-# INLINE unsafeThawIOUArray #-}
unsafeThawIOUArray :: UArray ix e -> IO (IOUArray ix e)
unsafeThawIOUArray :: UArray ix e -> IO (IOUArray ix e)
unsafeThawIOUArray UArray ix e
arr = ST RealWorld (IOUArray ix e) -> IO (IOUArray ix e)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (IOUArray ix e) -> IO (IOUArray ix e))
-> ST RealWorld (IOUArray ix e) -> IO (IOUArray ix e)
forall a b. (a -> b) -> a -> b
$ do
STUArray RealWorld ix e
marr <- UArray ix e -> ST RealWorld (STUArray RealWorld ix e)
forall i e s. UArray i e -> ST s (STUArray s i e)
unsafeThawSTUArray UArray ix e
arr
IOUArray ix e -> ST RealWorld (IOUArray ix e)
forall (m :: * -> *) a. Monad m => a -> m a
return (STUArray RealWorld ix e -> IOUArray ix e
forall i e. STUArray RealWorld i e -> IOUArray i e
IOUArray STUArray RealWorld ix e
marr)
{-# RULES
"unsafeThaw/IOUArray" unsafeThaw = unsafeThawIOUArray
#-}
thawIOUArray :: UArray ix e -> IO (IOUArray ix e)
thawIOUArray :: UArray ix e -> IO (IOUArray ix e)
thawIOUArray UArray ix e
arr = ST RealWorld (IOUArray ix e) -> IO (IOUArray ix e)
forall a. ST RealWorld a -> IO a
stToIO (ST RealWorld (IOUArray ix e) -> IO (IOUArray ix e))
-> ST RealWorld (IOUArray ix e) -> IO (IOUArray ix e)
forall a b. (a -> b) -> a -> b
$ do
STUArray RealWorld ix e
marr <- UArray ix e -> ST RealWorld (STUArray RealWorld ix e)
forall i e s. UArray i e -> ST s (STUArray s i e)
thawSTUArray UArray ix e
arr
IOUArray ix e -> ST RealWorld (IOUArray ix e)
forall (m :: * -> *) a. Monad m => a -> m a
return (STUArray RealWorld ix e -> IOUArray ix e
forall i e. STUArray RealWorld i e -> IOUArray i e
IOUArray STUArray RealWorld ix e
marr)
{-# RULES
"thaw/IOUArray" thaw = thawIOUArray
#-}
{-# INLINE unsafeFreezeIOUArray #-}
unsafeFreezeIOUArray :: IOUArray ix e -> IO (UArray ix e)
unsafeFreezeIOUArray :: IOUArray ix e -> IO (UArray ix e)
unsafeFreezeIOUArray (IOUArray STUArray RealWorld ix e
marr) = ST RealWorld (UArray ix e) -> IO (UArray ix e)
forall a. ST RealWorld a -> IO a
stToIO (STUArray RealWorld ix e -> ST RealWorld (UArray ix e)
forall s i e. STUArray s i e -> ST s (UArray i e)
unsafeFreezeSTUArray STUArray RealWorld ix e
marr)
{-# RULES
"unsafeFreeze/IOUArray" unsafeFreeze = unsafeFreezeIOUArray
#-}
freezeIOUArray :: IOUArray ix e -> IO (UArray ix e)
freezeIOUArray :: IOUArray ix e -> IO (UArray ix e)
freezeIOUArray (IOUArray STUArray RealWorld ix e
marr) = ST RealWorld (UArray ix e) -> IO (UArray ix e)
forall a. ST RealWorld a -> IO a
stToIO (STUArray RealWorld ix e -> ST RealWorld (UArray ix e)
forall s i e. STUArray s i e -> ST s (UArray i e)
freezeSTUArray STUArray RealWorld ix e
marr)
{-# RULES
"freeze/IOUArray" freeze = freezeIOUArray
#-}