{-# LANGUAGE MagicHash, UnboxedTuples, Rank2Types, FlexibleInstances,
MultiParamTypeClasses, UndecidableInstances, RecursiveDo #-}
module Control.Monad.ST.Trans.Internal where
import GHC.Base
import GHC.ST hiding (liftST)
import qualified Control.Monad.Fail as MF
import Control.Monad.Fix
import Control.Monad.Trans
import Control.Monad.Error.Class
import Control.Monad.Reader.Class
import Control.Monad.State.Class
import Control.Monad.Writer.Class
#if __GLASGOW_HASKELL__ <= 708
import Control.Applicative
#endif
import Data.Array.ST
import Data.Array.Base
import GHC.Int (Int8, Int16, Int32, Int64)
import GHC.Word (Word8, Word16, Word32, Word64)
import GHC.Ptr (Ptr, FunPtr)
import GHC.Stable (StablePtr)
newtype STT s m a = STT (State# s -> m (STTRet s a))
unSTT :: STT s m a -> (State# s -> m (STTRet s a))
unSTT :: forall s (m :: * -> *) a. STT s m a -> State# s -> m (STTRet s a)
unSTT (STT State# s -> m (STTRet s a)
f) = State# s -> m (STTRet s a)
f
data STTRet s a = STTRet (State# s) a
liftST :: Applicative m => ST s a -> STT s m a
liftST :: forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (ST STRep s a
f) = forall s (m :: * -> *) a. (State# s -> m (STTRet s a)) -> STT s m a
STT (\State# s
s -> let !(# State# s
s', a
a #) = STRep s a
f State# s
s in forall (f :: * -> *) a. Applicative f => a -> f a
pure (forall s a. State# s -> a -> STTRet s a
STTRet State# s
s' a
a))
{-# INLINE liftST #-}
instance (Monad m, Functor m) => Monad (STT s m) where
return :: forall a. a -> STT s m a
return = forall (f :: * -> *) a. Applicative f => a -> f a
pure
STT State# s -> m (STTRet s a)
m >>= :: forall a b. STT s m a -> (a -> STT s m b) -> STT s m b
>>= a -> STT s m b
k = forall s (m :: * -> *) a. (State# s -> m (STTRet s a)) -> STT s m a
STT forall a b. (a -> b) -> a -> b
$ \State# s
st ->
do STTRet s a
ret <- State# s -> m (STTRet s a)
m State# s
st
case STTRet s a
ret of
STTRet State# s
new_st a
a ->
forall s (m :: * -> *) a. STT s m a -> State# s -> m (STTRet s a)
unSTT (a -> STT s m b
k a
a) State# s
new_st
instance (MF.MonadFail m, Functor m) => MF.MonadFail (STT s m) where
fail :: forall a. String -> STT s m a
fail String
msg = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (forall (m :: * -> *) a. MonadFail m => String -> m a
fail String
msg)
instance (MonadIO m, Functor m) => MonadIO (STT s m) where
liftIO :: forall a. IO a -> STT s m a
liftIO = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO
instance MonadTrans (STT s) where
lift :: forall (m :: * -> *) a. Monad m => m a -> STT s m a
lift m a
m = forall s (m :: * -> *) a. (State# s -> m (STTRet s a)) -> STT s m a
STT forall a b. (a -> b) -> a -> b
$ \State# s
st ->
do a
a <- m a
m
forall (m :: * -> *) a. Monad m => a -> m a
return (forall s a. State# s -> a -> STTRet s a
STTRet State# s
st a
a)
liftSTT :: STT s m a -> State# s -> m (STTRet s a)
liftSTT :: forall s (m :: * -> *) a. STT s m a -> State# s -> m (STTRet s a)
liftSTT (STT State# s -> m (STTRet s a)
m) State# s
s = State# s -> m (STTRet s a)
m State# s
s
instance (MonadFix m, Functor m) => MonadFix (STT s m) where
mfix :: forall a. (a -> STT s m a) -> STT s m a
mfix a -> STT s m a
k = forall s (m :: * -> *) a. (State# s -> m (STTRet s a)) -> STT s m a
STT forall a b. (a -> b) -> a -> b
$ \ State# s
s -> mdo
ans :: STTRet s a
ans@(STTRet State# s
_ a
r) <- forall s (m :: * -> *) a. STT s m a -> State# s -> m (STTRet s a)
liftSTT (a -> STT s m a
k a
r) State# s
s
forall (m :: * -> *) a. Monad m => a -> m a
return STTRet s a
ans
instance Functor (STTRet s) where
fmap :: forall a b. (a -> b) -> STTRet s a -> STTRet s b
fmap a -> b
f (STTRet State# s
s a
a) = forall s a. State# s -> a -> STTRet s a
STTRet State# s
s (a -> b
f a
a)
instance Functor m => Functor (STT s m) where
fmap :: forall a b. (a -> b) -> STT s m a -> STT s m b
fmap a -> b
f (STT State# s -> m (STTRet s a)
g) = forall s (m :: * -> *) a. (State# s -> m (STTRet s a)) -> STT s m a
STT forall a b. (a -> b) -> a -> b
$ \State# s
s# -> (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap) a -> b
f (State# s -> m (STTRet s a)
g State# s
s#)
instance (Monad m, Functor m) => Applicative (STT s m) where
pure :: forall a. a -> STT s m a
pure a
a = forall s (m :: * -> *) a. (State# s -> m (STTRet s a)) -> STT s m a
STT forall a b. (a -> b) -> a -> b
$ \State# s
s# -> forall (m :: * -> *) a. Monad m => a -> m a
return (forall s a. State# s -> a -> STTRet s a
STTRet State# s
s# a
a)
(STT State# s -> m (STTRet s (a -> b))
m) <*> :: forall a b. STT s m (a -> b) -> STT s m a -> STT s m b
<*> (STT State# s -> m (STTRet s a)
n) = forall s (m :: * -> *) a. (State# s -> m (STTRet s a)) -> STT s m a
STT forall a b. (a -> b) -> a -> b
$ \State# s
s1 ->
do (STTRet State# s
s2 a -> b
f) <- State# s -> m (STTRet s (a -> b))
m State# s
s1
(STTRet State# s
s3 a
x) <- State# s -> m (STTRet s a)
n State# s
s2
forall (m :: * -> *) a. Monad m => a -> m a
return (forall s a. State# s -> a -> STTRet s a
STTRet State# s
s3 (a -> b
f a
x))
instance (Monad m, Alternative m) => Alternative (STT s m) where
empty :: forall a. STT s m a
empty = forall s (m :: * -> *) a. (State# s -> m (STTRet s a)) -> STT s m a
STT forall a b. (a -> b) -> a -> b
$ \State# s
_ -> forall (f :: * -> *) a. Alternative f => f a
empty
STT State# s -> m (STTRet s a)
m <|> :: forall a. STT s m a -> STT s m a -> STT s m a
<|> STT State# s -> m (STTRet s a)
n = forall s (m :: * -> *) a. (State# s -> m (STTRet s a)) -> STT s m a
STT forall a b. (a -> b) -> a -> b
$ \State# s
s# -> State# s -> m (STTRet s a)
m State# s
s# forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> State# s -> m (STTRet s a)
n State# s
s#
instance (MonadError e m, Functor m) => MonadError e (STT s m) where
throwError :: forall a. e -> STT s m a
throwError e
e = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (forall e (m :: * -> *) a. MonadError e m => e -> m a
throwError e
e)
catchError :: forall a. STT s m a -> (e -> STT s m a) -> STT s m a
catchError (STT State# s -> m (STTRet s a)
m) e -> STT s m a
f = forall s (m :: * -> *) a. (State# s -> m (STTRet s a)) -> STT s m a
STT forall a b. (a -> b) -> a -> b
$ \State# s
st -> forall e (m :: * -> *) a.
MonadError e m =>
m a -> (e -> m a) -> m a
catchError (State# s -> m (STTRet s a)
m State# s
st)
(\e
e -> forall s (m :: * -> *) a. STT s m a -> State# s -> m (STTRet s a)
unSTT (e -> STT s m a
f e
e) State# s
st)
instance (MonadReader r m, Functor m) => MonadReader r (STT s m) where
ask :: STT s m r
ask = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall r (m :: * -> *). MonadReader r m => m r
ask
local :: forall a. (r -> r) -> STT s m a -> STT s m a
local r -> r
f (STT State# s -> m (STTRet s a)
m) = forall s (m :: * -> *) a. (State# s -> m (STTRet s a)) -> STT s m a
STT forall a b. (a -> b) -> a -> b
$ \State# s
st -> forall r (m :: * -> *) a. MonadReader r m => (r -> r) -> m a -> m a
local r -> r
f (State# s -> m (STTRet s a)
m State# s
st)
instance (MonadState s m, Functor m) => MonadState s (STT s1 m) where
get :: STT s1 m s
get = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift forall s (m :: * -> *). MonadState s m => m s
get
put :: s -> STT s1 m ()
put s
s = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (forall s (m :: * -> *). MonadState s m => s -> m ()
put s
s)
instance (MonadWriter w m, Functor m) => MonadWriter w (STT s m) where
tell :: w -> STT s m ()
tell w
w = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (forall w (m :: * -> *). MonadWriter w m => w -> m ()
tell w
w)
listen :: forall a. STT s m a -> STT s m (a, w)
listen (STT State# s -> m (STTRet s a)
m)= forall s (m :: * -> *) a. (State# s -> m (STTRet s a)) -> STT s m a
STT forall a b. (a -> b) -> a -> b
$ \State# s
st1 -> do (STTRet State# s
st2 a
a, w
w) <- forall w (m :: * -> *) a. MonadWriter w m => m a -> m (a, w)
listen (State# s -> m (STTRet s a)
m State# s
st1)
forall (m :: * -> *) a. Monad m => a -> m a
return (forall s a. State# s -> a -> STTRet s a
STTRet State# s
st2 (a
a,w
w))
pass :: forall a. STT s m (a, w -> w) -> STT s m a
pass (STT State# s -> m (STTRet s (a, w -> w))
m) = forall s (m :: * -> *) a. (State# s -> m (STTRet s a)) -> STT s m a
STT forall a b. (a -> b) -> a -> b
$ \State# s
st1 -> forall w (m :: * -> *) a. MonadWriter w m => m (a, w -> w) -> m a
pass (do (STTRet State# s
st2 (a
a,w -> w
f)) <- State# s -> m (STTRet s (a, w -> w))
m State# s
st1
forall (m :: * -> *) a. Monad m => a -> m a
return (forall s a. State# s -> a -> STTRet s a
STTRet State# s
st2 a
a, w -> w
f))
instance (Applicative m, Monad m) => MArray (STArray s) e (STT s m) where
{-# INLINE getBounds #-}
getBounds :: forall i. Ix i => STArray s i e -> STT s m (i, i)
getBounds STArray s i e
arr = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m (i, i)
getBounds STArray s i e
arr)
{-# INLINE getNumElements #-}
getNumElements :: forall i. Ix i => STArray s i e -> STT s m Int
getNumElements STArray s i e
arr = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m Int
getNumElements STArray s i e
arr)
{-# INLINE newArray #-}
newArray :: forall i. Ix i => (i, i) -> e -> STT s m (STArray s i e)
newArray (i, i)
bnds e
e = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> e -> m (a i e)
newArray (i, i)
bnds e
e)
{-# INLINE unsafeRead #-}
unsafeRead :: forall i. Ix i => STArray s i e -> Int -> STT s m e
unsafeRead STArray s i e
arr Int
i = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> m e
unsafeRead STArray s i e
arr Int
i)
{-# INLINE unsafeWrite #-}
unsafeWrite :: forall i. Ix i => STArray s i e -> Int -> e -> STT s m ()
unsafeWrite STArray s i e
arr Int
i e
e = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> e -> m ()
unsafeWrite STArray s i e
arr Int
i e
e)
instance (Applicative m, Monad m) => MArray (STUArray s) Bool (STT s m) where
{-# INLINE getBounds #-}
getBounds :: forall i. Ix i => STUArray s i Bool -> STT s m (i, i)
getBounds STUArray s i Bool
arr = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m (i, i)
getBounds STUArray s i Bool
arr)
{-# INLINE getNumElements #-}
getNumElements :: forall i. Ix i => STUArray s i Bool -> STT s m Int
getNumElements STUArray s i Bool
arr = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m Int
getNumElements STUArray s i Bool
arr)
{-# INLINE newArray #-}
newArray :: forall i. Ix i => (i, i) -> Bool -> STT s m (STUArray s i Bool)
newArray (i, i)
bnds Bool
e = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> e -> m (a i e)
newArray (i, i)
bnds Bool
e)
{-# INLINE newArray_ #-}
newArray_ :: forall i. Ix i => (i, i) -> STT s m (STUArray s i Bool)
newArray_ (i, i)
arrBounds = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
newArray_ (i, i)
arrBounds)
{-# INLINE unsafeNewArray_ #-}
unsafeNewArray_ :: forall i. Ix i => (i, i) -> STT s m (STUArray s i Bool)
unsafeNewArray_ (i, i)
bnds = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_ (i, i)
bnds)
{-# INLINE unsafeRead #-}
unsafeRead :: forall i. Ix i => STUArray s i Bool -> Int -> STT s m Bool
unsafeRead STUArray s i Bool
arr Int
i = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> m e
unsafeRead STUArray s i Bool
arr Int
i)
{-# INLINE unsafeWrite #-}
unsafeWrite :: forall i. Ix i => STUArray s i Bool -> Int -> Bool -> STT s m ()
unsafeWrite STUArray s i Bool
arr Int
i Bool
e = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> e -> m ()
unsafeWrite STUArray s i Bool
arr Int
i Bool
e)
instance (Applicative m, Monad m) => MArray (STUArray s) Char (STT s m) where
{-# INLINE getBounds #-}
getBounds :: forall i. Ix i => STUArray s i Char -> STT s m (i, i)
getBounds STUArray s i Char
arr = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m (i, i)
getBounds STUArray s i Char
arr)
{-# INLINE getNumElements #-}
getNumElements :: forall i. Ix i => STUArray s i Char -> STT s m Int
getNumElements STUArray s i Char
arr = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m Int
getNumElements STUArray s i Char
arr)
{-# INLINE newArray #-}
newArray :: forall i. Ix i => (i, i) -> Char -> STT s m (STUArray s i Char)
newArray (i, i)
bnds Char
e = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> e -> m (a i e)
newArray (i, i)
bnds Char
e)
{-# INLINE newArray_ #-}
newArray_ :: forall i. Ix i => (i, i) -> STT s m (STUArray s i Char)
newArray_ (i, i)
arrBounds = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
newArray_ (i, i)
arrBounds)
{-# INLINE unsafeNewArray_ #-}
unsafeNewArray_ :: forall i. Ix i => (i, i) -> STT s m (STUArray s i Char)
unsafeNewArray_ (i, i)
bnds = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_ (i, i)
bnds)
{-# INLINE unsafeRead #-}
unsafeRead :: forall i. Ix i => STUArray s i Char -> Int -> STT s m Char
unsafeRead STUArray s i Char
arr Int
i = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> m e
unsafeRead STUArray s i Char
arr Int
i)
{-# INLINE unsafeWrite #-}
unsafeWrite :: forall i. Ix i => STUArray s i Char -> Int -> Char -> STT s m ()
unsafeWrite STUArray s i Char
arr Int
i Char
e = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> e -> m ()
unsafeWrite STUArray s i Char
arr Int
i Char
e)
instance (Applicative m, Monad m) => MArray (STUArray s) Int (STT s m) where
{-# INLINE getBounds #-}
getBounds :: forall i. Ix i => STUArray s i Int -> STT s m (i, i)
getBounds STUArray s i Int
arr = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m (i, i)
getBounds STUArray s i Int
arr)
{-# INLINE getNumElements #-}
getNumElements :: forall i. Ix i => STUArray s i Int -> STT s m Int
getNumElements STUArray s i Int
arr = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m Int
getNumElements STUArray s i Int
arr)
{-# INLINE newArray #-}
newArray :: forall i. Ix i => (i, i) -> Int -> STT s m (STUArray s i Int)
newArray (i, i)
bnds Int
e = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> e -> m (a i e)
newArray (i, i)
bnds Int
e)
{-# INLINE newArray_ #-}
newArray_ :: forall i. Ix i => (i, i) -> STT s m (STUArray s i Int)
newArray_ (i, i)
arrBounds = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
newArray_ (i, i)
arrBounds)
{-# INLINE unsafeNewArray_ #-}
unsafeNewArray_ :: forall i. Ix i => (i, i) -> STT s m (STUArray s i Int)
unsafeNewArray_ (i, i)
bnds = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_ (i, i)
bnds)
{-# INLINE unsafeRead #-}
unsafeRead :: forall i. Ix i => STUArray s i Int -> Int -> STT s m Int
unsafeRead STUArray s i Int
arr Int
i = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> m e
unsafeRead STUArray s i Int
arr Int
i)
{-# INLINE unsafeWrite #-}
unsafeWrite :: forall i. Ix i => STUArray s i Int -> Int -> Int -> STT s m ()
unsafeWrite STUArray s i Int
arr Int
i Int
e = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> e -> m ()
unsafeWrite STUArray s i Int
arr Int
i Int
e)
instance (Applicative m, Monad m) => MArray (STUArray s) Word (STT s m) where
{-# INLINE getBounds #-}
getBounds :: forall i. Ix i => STUArray s i Word -> STT s m (i, i)
getBounds STUArray s i Word
arr = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m (i, i)
getBounds STUArray s i Word
arr)
{-# INLINE getNumElements #-}
getNumElements :: forall i. Ix i => STUArray s i Word -> STT s m Int
getNumElements STUArray s i Word
arr = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m Int
getNumElements STUArray s i Word
arr)
{-# INLINE newArray #-}
newArray :: forall i. Ix i => (i, i) -> Word -> STT s m (STUArray s i Word)
newArray (i, i)
bnds Word
e = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> e -> m (a i e)
newArray (i, i)
bnds Word
e)
{-# INLINE newArray_ #-}
newArray_ :: forall i. Ix i => (i, i) -> STT s m (STUArray s i Word)
newArray_ (i, i)
arrBounds = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
newArray_ (i, i)
arrBounds)
{-# INLINE unsafeNewArray_ #-}
unsafeNewArray_ :: forall i. Ix i => (i, i) -> STT s m (STUArray s i Word)
unsafeNewArray_ (i, i)
bnds = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_ (i, i)
bnds)
{-# INLINE unsafeRead #-}
unsafeRead :: forall i. Ix i => STUArray s i Word -> Int -> STT s m Word
unsafeRead STUArray s i Word
arr Int
i = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> m e
unsafeRead STUArray s i Word
arr Int
i)
{-# INLINE unsafeWrite #-}
unsafeWrite :: forall i. Ix i => STUArray s i Word -> Int -> Word -> STT s m ()
unsafeWrite STUArray s i Word
arr Int
i Word
e = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> e -> m ()
unsafeWrite STUArray s i Word
arr Int
i Word
e)
instance (Applicative m, Monad m) => MArray (STUArray s) (Ptr a) (STT s m) where
{-# INLINE getBounds #-}
getBounds :: forall i. Ix i => STUArray s i (Ptr a) -> STT s m (i, i)
getBounds STUArray s i (Ptr a)
arr = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m (i, i)
getBounds STUArray s i (Ptr a)
arr)
{-# INLINE getNumElements #-}
getNumElements :: forall i. Ix i => STUArray s i (Ptr a) -> STT s m Int
getNumElements STUArray s i (Ptr a)
arr = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m Int
getNumElements STUArray s i (Ptr a)
arr)
{-# INLINE newArray #-}
newArray :: forall i. Ix i => (i, i) -> Ptr a -> STT s m (STUArray s i (Ptr a))
newArray (i, i)
bnds Ptr a
e = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> e -> m (a i e)
newArray (i, i)
bnds Ptr a
e)
{-# INLINE newArray_ #-}
newArray_ :: forall i. Ix i => (i, i) -> STT s m (STUArray s i (Ptr a))
newArray_ (i, i)
arrBounds = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
newArray_ (i, i)
arrBounds)
{-# INLINE unsafeNewArray_ #-}
unsafeNewArray_ :: forall i. Ix i => (i, i) -> STT s m (STUArray s i (Ptr a))
unsafeNewArray_ (i, i)
bnds = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_ (i, i)
bnds)
{-# INLINE unsafeRead #-}
unsafeRead :: forall i. Ix i => STUArray s i (Ptr a) -> Int -> STT s m (Ptr a)
unsafeRead STUArray s i (Ptr a)
arr Int
i = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> m e
unsafeRead STUArray s i (Ptr a)
arr Int
i)
{-# INLINE unsafeWrite #-}
unsafeWrite :: forall i.
Ix i =>
STUArray s i (Ptr a) -> Int -> Ptr a -> STT s m ()
unsafeWrite STUArray s i (Ptr a)
arr Int
i Ptr a
e = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> e -> m ()
unsafeWrite STUArray s i (Ptr a)
arr Int
i Ptr a
e)
instance (Applicative m, Monad m) => MArray (STUArray s) (FunPtr a) (STT s m) where
{-# INLINE getBounds #-}
getBounds :: forall i. Ix i => STUArray s i (FunPtr a) -> STT s m (i, i)
getBounds STUArray s i (FunPtr a)
arr = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m (i, i)
getBounds STUArray s i (FunPtr a)
arr)
{-# INLINE getNumElements #-}
getNumElements :: forall i. Ix i => STUArray s i (FunPtr a) -> STT s m Int
getNumElements STUArray s i (FunPtr a)
arr = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m Int
getNumElements STUArray s i (FunPtr a)
arr)
{-# INLINE newArray #-}
newArray :: forall i.
Ix i =>
(i, i) -> FunPtr a -> STT s m (STUArray s i (FunPtr a))
newArray (i, i)
bnds FunPtr a
e = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> e -> m (a i e)
newArray (i, i)
bnds FunPtr a
e)
{-# INLINE newArray_ #-}
newArray_ :: forall i. Ix i => (i, i) -> STT s m (STUArray s i (FunPtr a))
newArray_ (i, i)
arrBounds = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
newArray_ (i, i)
arrBounds)
{-# INLINE unsafeNewArray_ #-}
unsafeNewArray_ :: forall i. Ix i => (i, i) -> STT s m (STUArray s i (FunPtr a))
unsafeNewArray_ (i, i)
bnds = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_ (i, i)
bnds)
{-# INLINE unsafeRead #-}
unsafeRead :: forall i.
Ix i =>
STUArray s i (FunPtr a) -> Int -> STT s m (FunPtr a)
unsafeRead STUArray s i (FunPtr a)
arr Int
i = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> m e
unsafeRead STUArray s i (FunPtr a)
arr Int
i)
{-# INLINE unsafeWrite #-}
unsafeWrite :: forall i.
Ix i =>
STUArray s i (FunPtr a) -> Int -> FunPtr a -> STT s m ()
unsafeWrite STUArray s i (FunPtr a)
arr Int
i FunPtr a
e = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> e -> m ()
unsafeWrite STUArray s i (FunPtr a)
arr Int
i FunPtr a
e)
instance (Applicative m, Monad m) => MArray (STUArray s) Float (STT s m) where
{-# INLINE getBounds #-}
getBounds :: forall i. Ix i => STUArray s i Float -> STT s m (i, i)
getBounds STUArray s i Float
arr = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m (i, i)
getBounds STUArray s i Float
arr)
{-# INLINE getNumElements #-}
getNumElements :: forall i. Ix i => STUArray s i Float -> STT s m Int
getNumElements STUArray s i Float
arr = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m Int
getNumElements STUArray s i Float
arr)
{-# INLINE newArray #-}
newArray :: forall i. Ix i => (i, i) -> Float -> STT s m (STUArray s i Float)
newArray (i, i)
bnds Float
e = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> e -> m (a i e)
newArray (i, i)
bnds Float
e)
{-# INLINE newArray_ #-}
newArray_ :: forall i. Ix i => (i, i) -> STT s m (STUArray s i Float)
newArray_ (i, i)
arrBounds = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
newArray_ (i, i)
arrBounds)
{-# INLINE unsafeNewArray_ #-}
unsafeNewArray_ :: forall i. Ix i => (i, i) -> STT s m (STUArray s i Float)
unsafeNewArray_ (i, i)
bnds = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_ (i, i)
bnds)
{-# INLINE unsafeRead #-}
unsafeRead :: forall i. Ix i => STUArray s i Float -> Int -> STT s m Float
unsafeRead STUArray s i Float
arr Int
i = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> m e
unsafeRead STUArray s i Float
arr Int
i)
{-# INLINE unsafeWrite #-}
unsafeWrite :: forall i. Ix i => STUArray s i Float -> Int -> Float -> STT s m ()
unsafeWrite STUArray s i Float
arr Int
i Float
e = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> e -> m ()
unsafeWrite STUArray s i Float
arr Int
i Float
e)
instance (Applicative m, Monad m) => MArray (STUArray s) Double (STT s m) where
{-# INLINE getBounds #-}
getBounds :: forall i. Ix i => STUArray s i Double -> STT s m (i, i)
getBounds STUArray s i Double
arr = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m (i, i)
getBounds STUArray s i Double
arr)
{-# INLINE getNumElements #-}
getNumElements :: forall i. Ix i => STUArray s i Double -> STT s m Int
getNumElements STUArray s i Double
arr = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m Int
getNumElements STUArray s i Double
arr)
{-# INLINE newArray #-}
newArray :: forall i. Ix i => (i, i) -> Double -> STT s m (STUArray s i Double)
newArray (i, i)
bnds Double
e = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> e -> m (a i e)
newArray (i, i)
bnds Double
e)
{-# INLINE newArray_ #-}
newArray_ :: forall i. Ix i => (i, i) -> STT s m (STUArray s i Double)
newArray_ (i, i)
arrBounds = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
newArray_ (i, i)
arrBounds)
{-# INLINE unsafeNewArray_ #-}
unsafeNewArray_ :: forall i. Ix i => (i, i) -> STT s m (STUArray s i Double)
unsafeNewArray_ (i, i)
bnds = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_ (i, i)
bnds)
{-# INLINE unsafeRead #-}
unsafeRead :: forall i. Ix i => STUArray s i Double -> Int -> STT s m Double
unsafeRead STUArray s i Double
arr Int
i = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> m e
unsafeRead STUArray s i Double
arr Int
i)
{-# INLINE unsafeWrite #-}
unsafeWrite :: forall i.
Ix i =>
STUArray s i Double -> Int -> Double -> STT s m ()
unsafeWrite STUArray s i Double
arr Int
i Double
e = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> e -> m ()
unsafeWrite STUArray s i Double
arr Int
i Double
e)
instance (Applicative m, Monad m) => MArray (STUArray s) (StablePtr a) (STT s m) where
{-# INLINE getBounds #-}
getBounds :: forall i. Ix i => STUArray s i (StablePtr a) -> STT s m (i, i)
getBounds STUArray s i (StablePtr a)
arr = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m (i, i)
getBounds STUArray s i (StablePtr a)
arr)
{-# INLINE getNumElements #-}
getNumElements :: forall i. Ix i => STUArray s i (StablePtr a) -> STT s m Int
getNumElements STUArray s i (StablePtr a)
arr = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m Int
getNumElements STUArray s i (StablePtr a)
arr)
{-# INLINE newArray #-}
newArray :: forall i.
Ix i =>
(i, i) -> StablePtr a -> STT s m (STUArray s i (StablePtr a))
newArray (i, i)
bnds StablePtr a
e = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> e -> m (a i e)
newArray (i, i)
bnds StablePtr a
e)
{-# INLINE newArray_ #-}
newArray_ :: forall i. Ix i => (i, i) -> STT s m (STUArray s i (StablePtr a))
newArray_ (i, i)
arrBounds = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
newArray_ (i, i)
arrBounds)
{-# INLINE unsafeNewArray_ #-}
unsafeNewArray_ :: forall i. Ix i => (i, i) -> STT s m (STUArray s i (StablePtr a))
unsafeNewArray_ (i, i)
bnds = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_ (i, i)
bnds)
{-# INLINE unsafeRead #-}
unsafeRead :: forall i.
Ix i =>
STUArray s i (StablePtr a) -> Int -> STT s m (StablePtr a)
unsafeRead STUArray s i (StablePtr a)
arr Int
i = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> m e
unsafeRead STUArray s i (StablePtr a)
arr Int
i)
{-# INLINE unsafeWrite #-}
unsafeWrite :: forall i.
Ix i =>
STUArray s i (StablePtr a) -> Int -> StablePtr a -> STT s m ()
unsafeWrite STUArray s i (StablePtr a)
arr Int
i StablePtr a
e = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> e -> m ()
unsafeWrite STUArray s i (StablePtr a)
arr Int
i StablePtr a
e)
instance (Applicative m, Monad m) => MArray (STUArray s) Int8 (STT s m) where
{-# INLINE getBounds #-}
getBounds :: forall i. Ix i => STUArray s i Int8 -> STT s m (i, i)
getBounds STUArray s i Int8
arr = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m (i, i)
getBounds STUArray s i Int8
arr)
{-# INLINE getNumElements #-}
getNumElements :: forall i. Ix i => STUArray s i Int8 -> STT s m Int
getNumElements STUArray s i Int8
arr = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m Int
getNumElements STUArray s i Int8
arr)
{-# INLINE newArray #-}
newArray :: forall i. Ix i => (i, i) -> Int8 -> STT s m (STUArray s i Int8)
newArray (i, i)
bnds Int8
e = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> e -> m (a i e)
newArray (i, i)
bnds Int8
e)
{-# INLINE newArray_ #-}
newArray_ :: forall i. Ix i => (i, i) -> STT s m (STUArray s i Int8)
newArray_ (i, i)
arrBounds = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
newArray_ (i, i)
arrBounds)
{-# INLINE unsafeNewArray_ #-}
unsafeNewArray_ :: forall i. Ix i => (i, i) -> STT s m (STUArray s i Int8)
unsafeNewArray_ (i, i)
bnds = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_ (i, i)
bnds)
{-# INLINE unsafeRead #-}
unsafeRead :: forall i. Ix i => STUArray s i Int8 -> Int -> STT s m Int8
unsafeRead STUArray s i Int8
arr Int
i = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> m e
unsafeRead STUArray s i Int8
arr Int
i)
{-# INLINE unsafeWrite #-}
unsafeWrite :: forall i. Ix i => STUArray s i Int8 -> Int -> Int8 -> STT s m ()
unsafeWrite STUArray s i Int8
arr Int
i Int8
e = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> e -> m ()
unsafeWrite STUArray s i Int8
arr Int
i Int8
e)
instance (Applicative m, Monad m) => MArray (STUArray s) Int16 (STT s m) where
{-# INLINE getBounds #-}
getBounds :: forall i. Ix i => STUArray s i Int16 -> STT s m (i, i)
getBounds STUArray s i Int16
arr = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m (i, i)
getBounds STUArray s i Int16
arr)
{-# INLINE getNumElements #-}
getNumElements :: forall i. Ix i => STUArray s i Int16 -> STT s m Int
getNumElements STUArray s i Int16
arr = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m Int
getNumElements STUArray s i Int16
arr)
{-# INLINE newArray #-}
newArray :: forall i. Ix i => (i, i) -> Int16 -> STT s m (STUArray s i Int16)
newArray (i, i)
bnds Int16
e = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> e -> m (a i e)
newArray (i, i)
bnds Int16
e)
{-# INLINE newArray_ #-}
newArray_ :: forall i. Ix i => (i, i) -> STT s m (STUArray s i Int16)
newArray_ (i, i)
arrBounds = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
newArray_ (i, i)
arrBounds)
{-# INLINE unsafeNewArray_ #-}
unsafeNewArray_ :: forall i. Ix i => (i, i) -> STT s m (STUArray s i Int16)
unsafeNewArray_ (i, i)
bnds = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_ (i, i)
bnds)
{-# INLINE unsafeRead #-}
unsafeRead :: forall i. Ix i => STUArray s i Int16 -> Int -> STT s m Int16
unsafeRead STUArray s i Int16
arr Int
i = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> m e
unsafeRead STUArray s i Int16
arr Int
i)
{-# INLINE unsafeWrite #-}
unsafeWrite :: forall i. Ix i => STUArray s i Int16 -> Int -> Int16 -> STT s m ()
unsafeWrite STUArray s i Int16
arr Int
i Int16
e = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> e -> m ()
unsafeWrite STUArray s i Int16
arr Int
i Int16
e)
instance (Applicative m, Monad m) => MArray (STUArray s) Int32 (STT s m) where
{-# INLINE getBounds #-}
getBounds :: forall i. Ix i => STUArray s i Int32 -> STT s m (i, i)
getBounds STUArray s i Int32
arr = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m (i, i)
getBounds STUArray s i Int32
arr)
{-# INLINE getNumElements #-}
getNumElements :: forall i. Ix i => STUArray s i Int32 -> STT s m Int
getNumElements STUArray s i Int32
arr = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m Int
getNumElements STUArray s i Int32
arr)
{-# INLINE newArray #-}
newArray :: forall i. Ix i => (i, i) -> Int32 -> STT s m (STUArray s i Int32)
newArray (i, i)
bnds Int32
e = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> e -> m (a i e)
newArray (i, i)
bnds Int32
e)
{-# INLINE newArray_ #-}
newArray_ :: forall i. Ix i => (i, i) -> STT s m (STUArray s i Int32)
newArray_ (i, i)
arrBounds = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
newArray_ (i, i)
arrBounds)
{-# INLINE unsafeNewArray_ #-}
unsafeNewArray_ :: forall i. Ix i => (i, i) -> STT s m (STUArray s i Int32)
unsafeNewArray_ (i, i)
bnds = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_ (i, i)
bnds)
{-# INLINE unsafeRead #-}
unsafeRead :: forall i. Ix i => STUArray s i Int32 -> Int -> STT s m Int32
unsafeRead STUArray s i Int32
arr Int
i = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> m e
unsafeRead STUArray s i Int32
arr Int
i)
{-# INLINE unsafeWrite #-}
unsafeWrite :: forall i. Ix i => STUArray s i Int32 -> Int -> Int32 -> STT s m ()
unsafeWrite STUArray s i Int32
arr Int
i Int32
e = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> e -> m ()
unsafeWrite STUArray s i Int32
arr Int
i Int32
e)
instance (Applicative m, Monad m) => MArray (STUArray s) Int64 (STT s m) where
{-# INLINE getBounds #-}
getBounds :: forall i. Ix i => STUArray s i Int64 -> STT s m (i, i)
getBounds STUArray s i Int64
arr = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m (i, i)
getBounds STUArray s i Int64
arr)
{-# INLINE getNumElements #-}
getNumElements :: forall i. Ix i => STUArray s i Int64 -> STT s m Int
getNumElements STUArray s i Int64
arr = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m Int
getNumElements STUArray s i Int64
arr)
{-# INLINE newArray #-}
newArray :: forall i. Ix i => (i, i) -> Int64 -> STT s m (STUArray s i Int64)
newArray (i, i)
bnds Int64
e = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> e -> m (a i e)
newArray (i, i)
bnds Int64
e)
{-# INLINE newArray_ #-}
newArray_ :: forall i. Ix i => (i, i) -> STT s m (STUArray s i Int64)
newArray_ (i, i)
arrBounds = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
newArray_ (i, i)
arrBounds)
{-# INLINE unsafeNewArray_ #-}
unsafeNewArray_ :: forall i. Ix i => (i, i) -> STT s m (STUArray s i Int64)
unsafeNewArray_ (i, i)
bnds = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_ (i, i)
bnds)
{-# INLINE unsafeRead #-}
unsafeRead :: forall i. Ix i => STUArray s i Int64 -> Int -> STT s m Int64
unsafeRead STUArray s i Int64
arr Int
i = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> m e
unsafeRead STUArray s i Int64
arr Int
i)
{-# INLINE unsafeWrite #-}
unsafeWrite :: forall i. Ix i => STUArray s i Int64 -> Int -> Int64 -> STT s m ()
unsafeWrite STUArray s i Int64
arr Int
i Int64
e = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> e -> m ()
unsafeWrite STUArray s i Int64
arr Int
i Int64
e)
instance (Applicative m, Monad m) => MArray (STUArray s) Word8 (STT s m) where
{-# INLINE getBounds #-}
getBounds :: forall i. Ix i => STUArray s i Word8 -> STT s m (i, i)
getBounds STUArray s i Word8
arr = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m (i, i)
getBounds STUArray s i Word8
arr)
{-# INLINE getNumElements #-}
getNumElements :: forall i. Ix i => STUArray s i Word8 -> STT s m Int
getNumElements STUArray s i Word8
arr = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m Int
getNumElements STUArray s i Word8
arr)
{-# INLINE newArray #-}
newArray :: forall i. Ix i => (i, i) -> Word8 -> STT s m (STUArray s i Word8)
newArray (i, i)
bnds Word8
e = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> e -> m (a i e)
newArray (i, i)
bnds Word8
e)
{-# INLINE newArray_ #-}
newArray_ :: forall i. Ix i => (i, i) -> STT s m (STUArray s i Word8)
newArray_ (i, i)
arrBounds = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
newArray_ (i, i)
arrBounds)
{-# INLINE unsafeNewArray_ #-}
unsafeNewArray_ :: forall i. Ix i => (i, i) -> STT s m (STUArray s i Word8)
unsafeNewArray_ (i, i)
bnds = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_ (i, i)
bnds)
{-# INLINE unsafeRead #-}
unsafeRead :: forall i. Ix i => STUArray s i Word8 -> Int -> STT s m Word8
unsafeRead STUArray s i Word8
arr Int
i = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> m e
unsafeRead STUArray s i Word8
arr Int
i)
{-# INLINE unsafeWrite #-}
unsafeWrite :: forall i. Ix i => STUArray s i Word8 -> Int -> Word8 -> STT s m ()
unsafeWrite STUArray s i Word8
arr Int
i Word8
e = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> e -> m ()
unsafeWrite STUArray s i Word8
arr Int
i Word8
e)
instance (Applicative m, Monad m) => MArray (STUArray s) Word16 (STT s m) where
{-# INLINE getBounds #-}
getBounds :: forall i. Ix i => STUArray s i Word16 -> STT s m (i, i)
getBounds STUArray s i Word16
arr = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m (i, i)
getBounds STUArray s i Word16
arr)
{-# INLINE getNumElements #-}
getNumElements :: forall i. Ix i => STUArray s i Word16 -> STT s m Int
getNumElements STUArray s i Word16
arr = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m Int
getNumElements STUArray s i Word16
arr)
{-# INLINE newArray #-}
newArray :: forall i. Ix i => (i, i) -> Word16 -> STT s m (STUArray s i Word16)
newArray (i, i)
bnds Word16
e = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> e -> m (a i e)
newArray (i, i)
bnds Word16
e)
{-# INLINE newArray_ #-}
newArray_ :: forall i. Ix i => (i, i) -> STT s m (STUArray s i Word16)
newArray_ (i, i)
arrBounds = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
newArray_ (i, i)
arrBounds)
{-# INLINE unsafeNewArray_ #-}
unsafeNewArray_ :: forall i. Ix i => (i, i) -> STT s m (STUArray s i Word16)
unsafeNewArray_ (i, i)
bnds = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_ (i, i)
bnds)
{-# INLINE unsafeRead #-}
unsafeRead :: forall i. Ix i => STUArray s i Word16 -> Int -> STT s m Word16
unsafeRead STUArray s i Word16
arr Int
i = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> m e
unsafeRead STUArray s i Word16
arr Int
i)
{-# INLINE unsafeWrite #-}
unsafeWrite :: forall i.
Ix i =>
STUArray s i Word16 -> Int -> Word16 -> STT s m ()
unsafeWrite STUArray s i Word16
arr Int
i Word16
e = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> e -> m ()
unsafeWrite STUArray s i Word16
arr Int
i Word16
e)
instance (Applicative m, Monad m) => MArray (STUArray s) Word32 (STT s m) where
{-# INLINE getBounds #-}
getBounds :: forall i. Ix i => STUArray s i Word32 -> STT s m (i, i)
getBounds STUArray s i Word32
arr = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m (i, i)
getBounds STUArray s i Word32
arr)
{-# INLINE getNumElements #-}
getNumElements :: forall i. Ix i => STUArray s i Word32 -> STT s m Int
getNumElements STUArray s i Word32
arr = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m Int
getNumElements STUArray s i Word32
arr)
{-# INLINE newArray #-}
newArray :: forall i. Ix i => (i, i) -> Word32 -> STT s m (STUArray s i Word32)
newArray (i, i)
bnds Word32
e = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> e -> m (a i e)
newArray (i, i)
bnds Word32
e)
{-# INLINE newArray_ #-}
newArray_ :: forall i. Ix i => (i, i) -> STT s m (STUArray s i Word32)
newArray_ (i, i)
arrBounds = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
newArray_ (i, i)
arrBounds)
{-# INLINE unsafeNewArray_ #-}
unsafeNewArray_ :: forall i. Ix i => (i, i) -> STT s m (STUArray s i Word32)
unsafeNewArray_ (i, i)
bnds = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_ (i, i)
bnds)
{-# INLINE unsafeRead #-}
unsafeRead :: forall i. Ix i => STUArray s i Word32 -> Int -> STT s m Word32
unsafeRead STUArray s i Word32
arr Int
i = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> m e
unsafeRead STUArray s i Word32
arr Int
i)
{-# INLINE unsafeWrite #-}
unsafeWrite :: forall i.
Ix i =>
STUArray s i Word32 -> Int -> Word32 -> STT s m ()
unsafeWrite STUArray s i Word32
arr Int
i Word32
e = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> e -> m ()
unsafeWrite STUArray s i Word32
arr Int
i Word32
e)
instance (Applicative m, Monad m) => MArray (STUArray s) Word64 (STT s m) where
{-# INLINE getBounds #-}
getBounds :: forall i. Ix i => STUArray s i Word64 -> STT s m (i, i)
getBounds STUArray s i Word64
arr = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m (i, i)
getBounds STUArray s i Word64
arr)
{-# INLINE getNumElements #-}
getNumElements :: forall i. Ix i => STUArray s i Word64 -> STT s m Int
getNumElements STUArray s i Word64
arr = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> m Int
getNumElements STUArray s i Word64
arr)
{-# INLINE newArray #-}
newArray :: forall i. Ix i => (i, i) -> Word64 -> STT s m (STUArray s i Word64)
newArray (i, i)
bnds Word64
e = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> e -> m (a i e)
newArray (i, i)
bnds Word64
e)
{-# INLINE newArray_ #-}
newArray_ :: forall i. Ix i => (i, i) -> STT s m (STUArray s i Word64)
newArray_ (i, i)
arrBounds = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
newArray_ (i, i)
arrBounds)
{-# INLINE unsafeNewArray_ #-}
unsafeNewArray_ :: forall i. Ix i => (i, i) -> STT s m (STUArray s i Word64)
unsafeNewArray_ (i, i)
bnds = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
(i, i) -> m (a i e)
unsafeNewArray_ (i, i)
bnds)
{-# INLINE unsafeRead #-}
unsafeRead :: forall i. Ix i => STUArray s i Word64 -> Int -> STT s m Word64
unsafeRead STUArray s i Word64
arr Int
i = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> m e
unsafeRead STUArray s i Word64
arr Int
i)
{-# INLINE unsafeWrite #-}
unsafeWrite :: forall i.
Ix i =>
STUArray s i Word64 -> Int -> Word64 -> STT s m ()
unsafeWrite STUArray s i Word64
arr Int
i Word64
e = forall (m :: * -> *) s a. Applicative m => ST s a -> STT s m a
liftST (forall (a :: * -> * -> *) e (m :: * -> *) i.
(MArray a e m, Ix i) =>
a i e -> Int -> e -> m ()
unsafeWrite STUArray s i Word64
arr Int
i Word64
e)