{-# LANGUAGE DataKinds                  #-}
{-# LANGUAGE DeriveDataTypeable         #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE KindSignatures             #-}
{-# OPTIONS_HADDOCK not-home            #-}

module Data.Vector.Generic.Mutable.Sized.Internal
  ( MVector(..)
  )
where

import           GHC.TypeLits
import           Control.DeepSeq                ( NFData )
import           Data.Data
import           Foreign.Storable

-- | A wrapper to tag mutable vectors with a type level length.
--
-- Be careful when using the constructor here to not construct sized vectors
-- which have a different length than that specified in the type parameter!
newtype MVector v (n :: Nat) s a = MVector (v s a)
  deriving ( Typeable, Typeable (MVector v n s a)
DataType
Constr
Typeable (MVector v n s a) =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> MVector v n s a -> c (MVector v n s a))
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (MVector v n s a))
-> (MVector v n s a -> Constr)
-> (MVector v n s a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (MVector v n s a)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (MVector v n s a)))
-> ((forall b. Data b => b -> b)
    -> MVector v n s a -> MVector v n s a)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> MVector v n s a -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> MVector v n s a -> r)
-> (forall u.
    (forall d. Data d => d -> u) -> MVector v n s a -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> MVector v n s a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d)
    -> MVector v n s a -> m (MVector v n s a))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> MVector v n s a -> m (MVector v n s a))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d)
    -> MVector v n s a -> m (MVector v n s a))
-> Data (MVector v n s a)
MVector v n s a -> DataType
MVector v n s a -> Constr
(forall b. Data b => b -> b) -> MVector v n s a -> MVector v n s a
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> MVector v n s a -> c (MVector v n s a)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (MVector v n s a)
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u.
Int -> (forall d. Data d => d -> u) -> MVector v n s a -> u
forall u. (forall d. Data d => d -> u) -> MVector v n s a -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> MVector v n s a -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> MVector v n s a -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d)
-> MVector v n s a -> m (MVector v n s a)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d)
-> MVector v n s a -> m (MVector v n s a)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (MVector v n s a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> MVector v n s a -> c (MVector v n s a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (MVector v n s a))
forall (v :: * -> * -> *) (n :: Nat) s a.
(KnownNat n, Typeable v, Typeable s, Typeable a, Data (v s a)) =>
Typeable (MVector v n s a)
forall (v :: * -> * -> *) (n :: Nat) s a.
(KnownNat n, Typeable v, Typeable s, Typeable a, Data (v s a)) =>
MVector v n s a -> DataType
forall (v :: * -> * -> *) (n :: Nat) s a.
(KnownNat n, Typeable v, Typeable s, Typeable a, Data (v s a)) =>
MVector v n s a -> Constr
forall (v :: * -> * -> *) (n :: Nat) s a.
(KnownNat n, Typeable v, Typeable s, Typeable a, Data (v s a)) =>
(forall b. Data b => b -> b) -> MVector v n s a -> MVector v n s a
forall (v :: * -> * -> *) (n :: Nat) s a u.
(KnownNat n, Typeable v, Typeable s, Typeable a, Data (v s a)) =>
Int -> (forall d. Data d => d -> u) -> MVector v n s a -> u
forall (v :: * -> * -> *) (n :: Nat) s a u.
(KnownNat n, Typeable v, Typeable s, Typeable a, Data (v s a)) =>
(forall d. Data d => d -> u) -> MVector v n s a -> [u]
forall (v :: * -> * -> *) (n :: Nat) s a r r'.
(KnownNat n, Typeable v, Typeable s, Typeable a, Data (v s a)) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> MVector v n s a -> r
forall (v :: * -> * -> *) (n :: Nat) s a r r'.
(KnownNat n, Typeable v, Typeable s, Typeable a, Data (v s a)) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> MVector v n s a -> r
forall (v :: * -> * -> *) (n :: Nat) s a (m :: * -> *).
(KnownNat n, Typeable v, Typeable s, Typeable a, Data (v s a),
 Monad m) =>
(forall d. Data d => d -> m d)
-> MVector v n s a -> m (MVector v n s a)
forall (v :: * -> * -> *) (n :: Nat) s a (m :: * -> *).
(KnownNat n, Typeable v, Typeable s, Typeable a, Data (v s a),
 MonadPlus m) =>
(forall d. Data d => d -> m d)
-> MVector v n s a -> m (MVector v n s a)
forall (v :: * -> * -> *) (n :: Nat) s a (c :: * -> *).
(KnownNat n, Typeable v, Typeable s, Typeable a, Data (v s a)) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (MVector v n s a)
forall (v :: * -> * -> *) (n :: Nat) s a (c :: * -> *).
(KnownNat n, Typeable v, Typeable s, Typeable a, Data (v s a)) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> MVector v n s a -> c (MVector v n s a)
forall (v :: * -> * -> *) (n :: Nat) s a (t :: * -> *)
       (c :: * -> *).
(KnownNat n, Typeable v, Typeable s, Typeable a, Data (v s a),
 Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (MVector v n s a))
forall (v :: * -> * -> *) (n :: Nat) s a (t :: * -> * -> *)
       (c :: * -> *).
(KnownNat n, Typeable v, Typeable s, Typeable a, Data (v s a),
 Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (MVector v n s a))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (MVector v n s a))
$cMVector :: Constr
$tMVector :: DataType
gmapMo :: (forall d. Data d => d -> m d)
-> MVector v n s a -> m (MVector v n s a)
$cgmapMo :: forall (v :: * -> * -> *) (n :: Nat) s a (m :: * -> *).
(KnownNat n, Typeable v, Typeable s, Typeable a, Data (v s a),
 MonadPlus m) =>
(forall d. Data d => d -> m d)
-> MVector v n s a -> m (MVector v n s a)
gmapMp :: (forall d. Data d => d -> m d)
-> MVector v n s a -> m (MVector v n s a)
$cgmapMp :: forall (v :: * -> * -> *) (n :: Nat) s a (m :: * -> *).
(KnownNat n, Typeable v, Typeable s, Typeable a, Data (v s a),
 MonadPlus m) =>
(forall d. Data d => d -> m d)
-> MVector v n s a -> m (MVector v n s a)
gmapM :: (forall d. Data d => d -> m d)
-> MVector v n s a -> m (MVector v n s a)
$cgmapM :: forall (v :: * -> * -> *) (n :: Nat) s a (m :: * -> *).
(KnownNat n, Typeable v, Typeable s, Typeable a, Data (v s a),
 Monad m) =>
(forall d. Data d => d -> m d)
-> MVector v n s a -> m (MVector v n s a)
gmapQi :: Int -> (forall d. Data d => d -> u) -> MVector v n s a -> u
$cgmapQi :: forall (v :: * -> * -> *) (n :: Nat) s a u.
(KnownNat n, Typeable v, Typeable s, Typeable a, Data (v s a)) =>
Int -> (forall d. Data d => d -> u) -> MVector v n s a -> u
gmapQ :: (forall d. Data d => d -> u) -> MVector v n s a -> [u]
$cgmapQ :: forall (v :: * -> * -> *) (n :: Nat) s a u.
(KnownNat n, Typeable v, Typeable s, Typeable a, Data (v s a)) =>
(forall d. Data d => d -> u) -> MVector v n s a -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> MVector v n s a -> r
$cgmapQr :: forall (v :: * -> * -> *) (n :: Nat) s a r r'.
(KnownNat n, Typeable v, Typeable s, Typeable a, Data (v s a)) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> MVector v n s a -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> MVector v n s a -> r
$cgmapQl :: forall (v :: * -> * -> *) (n :: Nat) s a r r'.
(KnownNat n, Typeable v, Typeable s, Typeable a, Data (v s a)) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> MVector v n s a -> r
gmapT :: (forall b. Data b => b -> b) -> MVector v n s a -> MVector v n s a
$cgmapT :: forall (v :: * -> * -> *) (n :: Nat) s a.
(KnownNat n, Typeable v, Typeable s, Typeable a, Data (v s a)) =>
(forall b. Data b => b -> b) -> MVector v n s a -> MVector v n s a
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (MVector v n s a))
$cdataCast2 :: forall (v :: * -> * -> *) (n :: Nat) s a (t :: * -> * -> *)
       (c :: * -> *).
(KnownNat n, Typeable v, Typeable s, Typeable a, Data (v s a),
 Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (MVector v n s a))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (MVector v n s a))
$cdataCast1 :: forall (v :: * -> * -> *) (n :: Nat) s a (t :: * -> *)
       (c :: * -> *).
(KnownNat n, Typeable v, Typeable s, Typeable a, Data (v s a),
 Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (MVector v n s a))
dataTypeOf :: MVector v n s a -> DataType
$cdataTypeOf :: forall (v :: * -> * -> *) (n :: Nat) s a.
(KnownNat n, Typeable v, Typeable s, Typeable a, Data (v s a)) =>
MVector v n s a -> DataType
toConstr :: MVector v n s a -> Constr
$ctoConstr :: forall (v :: * -> * -> *) (n :: Nat) s a.
(KnownNat n, Typeable v, Typeable s, Typeable a, Data (v s a)) =>
MVector v n s a -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (MVector v n s a)
$cgunfold :: forall (v :: * -> * -> *) (n :: Nat) s a (c :: * -> *).
(KnownNat n, Typeable v, Typeable s, Typeable a, Data (v s a)) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (MVector v n s a)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> MVector v n s a -> c (MVector v n s a)
$cgfoldl :: forall (v :: * -> * -> *) (n :: Nat) s a (c :: * -> *).
(KnownNat n, Typeable v, Typeable s, Typeable a, Data (v s a)) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> MVector v n s a -> c (MVector v n s a)
$cp1Data :: forall (v :: * -> * -> *) (n :: Nat) s a.
(KnownNat n, Typeable v, Typeable s, Typeable a, Data (v s a)) =>
Typeable (MVector v n s a)
Data, Ptr b -> Int -> IO (MVector v n s a)
Ptr b -> Int -> MVector v n s a -> IO ()
Ptr (MVector v n s a) -> IO (MVector v n s a)
Ptr (MVector v n s a) -> Int -> IO (MVector v n s a)
Ptr (MVector v n s a) -> Int -> MVector v n s a -> IO ()
Ptr (MVector v n s a) -> MVector v n s a -> IO ()
MVector v n s a -> Int
(MVector v n s a -> Int)
-> (MVector v n s a -> Int)
-> (Ptr (MVector v n s a) -> Int -> IO (MVector v n s a))
-> (Ptr (MVector v n s a) -> Int -> MVector v n s a -> IO ())
-> (forall b. Ptr b -> Int -> IO (MVector v n s a))
-> (forall b. Ptr b -> Int -> MVector v n s a -> IO ())
-> (Ptr (MVector v n s a) -> IO (MVector v n s a))
-> (Ptr (MVector v n s a) -> MVector v n s a -> IO ())
-> Storable (MVector v n s a)
forall b. Ptr b -> Int -> IO (MVector v n s a)
forall b. Ptr b -> Int -> MVector v n s a -> IO ()
forall a.
(a -> Int)
-> (a -> Int)
-> (Ptr a -> Int -> IO a)
-> (Ptr a -> Int -> a -> IO ())
-> (forall b. Ptr b -> Int -> IO a)
-> (forall b. Ptr b -> Int -> a -> IO ())
-> (Ptr a -> IO a)
-> (Ptr a -> a -> IO ())
-> Storable a
forall (v :: * -> * -> *) (n :: Nat) s a.
Storable (v s a) =>
Ptr (MVector v n s a) -> IO (MVector v n s a)
forall (v :: * -> * -> *) (n :: Nat) s a.
Storable (v s a) =>
Ptr (MVector v n s a) -> Int -> IO (MVector v n s a)
forall (v :: * -> * -> *) (n :: Nat) s a.
Storable (v s a) =>
Ptr (MVector v n s a) -> Int -> MVector v n s a -> IO ()
forall (v :: * -> * -> *) (n :: Nat) s a.
Storable (v s a) =>
Ptr (MVector v n s a) -> MVector v n s a -> IO ()
forall (v :: * -> * -> *) (n :: Nat) s a.
Storable (v s a) =>
MVector v n s a -> Int
forall (v :: * -> * -> *) (n :: Nat) s a b.
Storable (v s a) =>
Ptr b -> Int -> IO (MVector v n s a)
forall (v :: * -> * -> *) (n :: Nat) s a b.
Storable (v s a) =>
Ptr b -> Int -> MVector v n s a -> IO ()
poke :: Ptr (MVector v n s a) -> MVector v n s a -> IO ()
$cpoke :: forall (v :: * -> * -> *) (n :: Nat) s a.
Storable (v s a) =>
Ptr (MVector v n s a) -> MVector v n s a -> IO ()
peek :: Ptr (MVector v n s a) -> IO (MVector v n s a)
$cpeek :: forall (v :: * -> * -> *) (n :: Nat) s a.
Storable (v s a) =>
Ptr (MVector v n s a) -> IO (MVector v n s a)
pokeByteOff :: Ptr b -> Int -> MVector v n s a -> IO ()
$cpokeByteOff :: forall (v :: * -> * -> *) (n :: Nat) s a b.
Storable (v s a) =>
Ptr b -> Int -> MVector v n s a -> IO ()
peekByteOff :: Ptr b -> Int -> IO (MVector v n s a)
$cpeekByteOff :: forall (v :: * -> * -> *) (n :: Nat) s a b.
Storable (v s a) =>
Ptr b -> Int -> IO (MVector v n s a)
pokeElemOff :: Ptr (MVector v n s a) -> Int -> MVector v n s a -> IO ()
$cpokeElemOff :: forall (v :: * -> * -> *) (n :: Nat) s a.
Storable (v s a) =>
Ptr (MVector v n s a) -> Int -> MVector v n s a -> IO ()
peekElemOff :: Ptr (MVector v n s a) -> Int -> IO (MVector v n s a)
$cpeekElemOff :: forall (v :: * -> * -> *) (n :: Nat) s a.
Storable (v s a) =>
Ptr (MVector v n s a) -> Int -> IO (MVector v n s a)
alignment :: MVector v n s a -> Int
$calignment :: forall (v :: * -> * -> *) (n :: Nat) s a.
Storable (v s a) =>
MVector v n s a -> Int
sizeOf :: MVector v n s a -> Int
$csizeOf :: forall (v :: * -> * -> *) (n :: Nat) s a.
Storable (v s a) =>
MVector v n s a -> Int
Storable, MVector v n s a -> ()
(MVector v n s a -> ()) -> NFData (MVector v n s a)
forall a. (a -> ()) -> NFData a
forall (v :: * -> * -> *) (n :: Nat) s a.
NFData (v s a) =>
MVector v n s a -> ()
rnf :: MVector v n s a -> ()
$crnf :: forall (v :: * -> * -> *) (n :: Nat) s a.
NFData (v s a) =>
MVector v n s a -> ()
NFData )