{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE KindSignatures #-}
{-# OPTIONS_HADDOCK not-home #-}
module Data.Vector.Generic.Sized.Internal
( Vector(..)
)
where
import Control.DeepSeq ( NFData )
import Data.Data ( Data
, Typeable
)
import Data.Functor.Classes ( Eq1
, Ord1
, Show1
)
import Data.Vector as V
( and
, foldl'
, null
, zipWith
, zipWith3
)
import qualified Data.Vector.Generic as VG
( Vector
, convert
, empty
, fromList
, toList
)
import GHC.Arr ( Ix
( inRange
, range
, unsafeIndex
, unsafeRangeSize
)
)
import GHC.TypeLits ( Nat )
newtype Vector v (n :: Nat) a = Vector (v a)
deriving ( Int -> Vector v n a -> ShowS
[Vector v n a] -> ShowS
Vector v n a -> String
(Int -> Vector v n a -> ShowS)
-> (Vector v n a -> String)
-> ([Vector v n a] -> ShowS)
-> Show (Vector v n a)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall (v :: * -> *) (n :: Nat) a.
Show (v a) =>
Int -> Vector v n a -> ShowS
forall (v :: * -> *) (n :: Nat) a.
Show (v a) =>
[Vector v n a] -> ShowS
forall (v :: * -> *) (n :: Nat) a.
Show (v a) =>
Vector v n a -> String
showList :: [Vector v n a] -> ShowS
$cshowList :: forall (v :: * -> *) (n :: Nat) a.
Show (v a) =>
[Vector v n a] -> ShowS
show :: Vector v n a -> String
$cshow :: forall (v :: * -> *) (n :: Nat) a.
Show (v a) =>
Vector v n a -> String
showsPrec :: Int -> Vector v n a -> ShowS
$cshowsPrec :: forall (v :: * -> *) (n :: Nat) a.
Show (v a) =>
Int -> Vector v n a -> ShowS
Show, Vector v n a -> Vector v n a -> Bool
(Vector v n a -> Vector v n a -> Bool)
-> (Vector v n a -> Vector v n a -> Bool) -> Eq (Vector v n a)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall (v :: * -> *) (n :: Nat) a.
Eq (v a) =>
Vector v n a -> Vector v n a -> Bool
/= :: Vector v n a -> Vector v n a -> Bool
$c/= :: forall (v :: * -> *) (n :: Nat) a.
Eq (v a) =>
Vector v n a -> Vector v n a -> Bool
== :: Vector v n a -> Vector v n a -> Bool
$c== :: forall (v :: * -> *) (n :: Nat) a.
Eq (v a) =>
Vector v n a -> Vector v n a -> Bool
Eq, Eq (Vector v n a)
Eq (Vector v n a)
-> (Vector v n a -> Vector v n a -> Ordering)
-> (Vector v n a -> Vector v n a -> Bool)
-> (Vector v n a -> Vector v n a -> Bool)
-> (Vector v n a -> Vector v n a -> Bool)
-> (Vector v n a -> Vector v n a -> Bool)
-> (Vector v n a -> Vector v n a -> Vector v n a)
-> (Vector v n a -> Vector v n a -> Vector v n a)
-> Ord (Vector v n a)
Vector v n a -> Vector v n a -> Bool
Vector v n a -> Vector v n a -> Ordering
Vector v n a -> Vector v n a -> Vector v n a
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
forall (v :: * -> *) (n :: Nat) a. Ord (v a) => Eq (Vector v n a)
forall (v :: * -> *) (n :: Nat) a.
Ord (v a) =>
Vector v n a -> Vector v n a -> Bool
forall (v :: * -> *) (n :: Nat) a.
Ord (v a) =>
Vector v n a -> Vector v n a -> Ordering
forall (v :: * -> *) (n :: Nat) a.
Ord (v a) =>
Vector v n a -> Vector v n a -> Vector v n a
min :: Vector v n a -> Vector v n a -> Vector v n a
$cmin :: forall (v :: * -> *) (n :: Nat) a.
Ord (v a) =>
Vector v n a -> Vector v n a -> Vector v n a
max :: Vector v n a -> Vector v n a -> Vector v n a
$cmax :: forall (v :: * -> *) (n :: Nat) a.
Ord (v a) =>
Vector v n a -> Vector v n a -> Vector v n a
>= :: Vector v n a -> Vector v n a -> Bool
$c>= :: forall (v :: * -> *) (n :: Nat) a.
Ord (v a) =>
Vector v n a -> Vector v n a -> Bool
> :: Vector v n a -> Vector v n a -> Bool
$c> :: forall (v :: * -> *) (n :: Nat) a.
Ord (v a) =>
Vector v n a -> Vector v n a -> Bool
<= :: Vector v n a -> Vector v n a -> Bool
$c<= :: forall (v :: * -> *) (n :: Nat) a.
Ord (v a) =>
Vector v n a -> Vector v n a -> Bool
< :: Vector v n a -> Vector v n a -> Bool
$c< :: forall (v :: * -> *) (n :: Nat) a.
Ord (v a) =>
Vector v n a -> Vector v n a -> Bool
compare :: Vector v n a -> Vector v n a -> Ordering
$ccompare :: forall (v :: * -> *) (n :: Nat) a.
Ord (v a) =>
Vector v n a -> Vector v n a -> Ordering
$cp1Ord :: forall (v :: * -> *) (n :: Nat) a. Ord (v a) => Eq (Vector v n a)
Ord, a -> Vector v n b -> Vector v n a
(a -> b) -> Vector v n a -> Vector v n b
(forall a b. (a -> b) -> Vector v n a -> Vector v n b)
-> (forall a b. a -> Vector v n b -> Vector v n a)
-> Functor (Vector v n)
forall a b. a -> Vector v n b -> Vector v n a
forall a b. (a -> b) -> Vector v n a -> Vector v n b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
forall (v :: * -> *) (n :: Nat) a b.
Functor v =>
a -> Vector v n b -> Vector v n a
forall (v :: * -> *) (n :: Nat) a b.
Functor v =>
(a -> b) -> Vector v n a -> Vector v n b
<$ :: a -> Vector v n b -> Vector v n a
$c<$ :: forall (v :: * -> *) (n :: Nat) a b.
Functor v =>
a -> Vector v n b -> Vector v n a
fmap :: (a -> b) -> Vector v n a -> Vector v n b
$cfmap :: forall (v :: * -> *) (n :: Nat) a b.
Functor v =>
(a -> b) -> Vector v n a -> Vector v n b
Functor, a -> Vector v n a -> Bool
Vector v n m -> m
Vector v n a -> [a]
Vector v n a -> Bool
Vector v n a -> Int
Vector v n a -> a
Vector v n a -> a
Vector v n a -> a
Vector v n a -> a
(a -> m) -> Vector v n a -> m
(a -> m) -> Vector v n a -> m
(a -> b -> b) -> b -> Vector v n a -> b
(a -> b -> b) -> b -> Vector v n a -> b
(b -> a -> b) -> b -> Vector v n a -> b
(b -> a -> b) -> b -> Vector v n a -> b
(a -> a -> a) -> Vector v n a -> a
(a -> a -> a) -> Vector v n a -> a
(forall m. Monoid m => Vector v n m -> m)
-> (forall m a. Monoid m => (a -> m) -> Vector v n a -> m)
-> (forall m a. Monoid m => (a -> m) -> Vector v n a -> m)
-> (forall a b. (a -> b -> b) -> b -> Vector v n a -> b)
-> (forall a b. (a -> b -> b) -> b -> Vector v n a -> b)
-> (forall b a. (b -> a -> b) -> b -> Vector v n a -> b)
-> (forall b a. (b -> a -> b) -> b -> Vector v n a -> b)
-> (forall a. (a -> a -> a) -> Vector v n a -> a)
-> (forall a. (a -> a -> a) -> Vector v n a -> a)
-> (forall a. Vector v n a -> [a])
-> (forall a. Vector v n a -> Bool)
-> (forall a. Vector v n a -> Int)
-> (forall a. Eq a => a -> Vector v n a -> Bool)
-> (forall a. Ord a => Vector v n a -> a)
-> (forall a. Ord a => Vector v n a -> a)
-> (forall a. Num a => Vector v n a -> a)
-> (forall a. Num a => Vector v n a -> a)
-> Foldable (Vector v n)
forall a. Eq a => a -> Vector v n a -> Bool
forall a. Num a => Vector v n a -> a
forall a. Ord a => Vector v n a -> a
forall m. Monoid m => Vector v n m -> m
forall a. Vector v n a -> Bool
forall a. Vector v n a -> Int
forall a. Vector v n a -> [a]
forall a. (a -> a -> a) -> Vector v n a -> a
forall m a. Monoid m => (a -> m) -> Vector v n a -> m
forall b a. (b -> a -> b) -> b -> Vector v n a -> b
forall a b. (a -> b -> b) -> b -> Vector v n a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
forall (v :: * -> *) (n :: Nat) a.
(Foldable v, Eq a) =>
a -> Vector v n a -> Bool
forall (v :: * -> *) (n :: Nat) a.
(Foldable v, Num a) =>
Vector v n a -> a
forall (v :: * -> *) (n :: Nat) a.
(Foldable v, Ord a) =>
Vector v n a -> a
forall (v :: * -> *) (n :: Nat) m.
(Foldable v, Monoid m) =>
Vector v n m -> m
forall (v :: * -> *) (n :: Nat) a.
Foldable v =>
Vector v n a -> Bool
forall (v :: * -> *) (n :: Nat) a.
Foldable v =>
Vector v n a -> Int
forall (v :: * -> *) (n :: Nat) a.
Foldable v =>
Vector v n a -> [a]
forall (v :: * -> *) (n :: Nat) a.
Foldable v =>
(a -> a -> a) -> Vector v n a -> a
forall (v :: * -> *) (n :: Nat) m a.
(Foldable v, Monoid m) =>
(a -> m) -> Vector v n a -> m
forall (v :: * -> *) (n :: Nat) b a.
Foldable v =>
(b -> a -> b) -> b -> Vector v n a -> b
forall (v :: * -> *) (n :: Nat) a b.
Foldable v =>
(a -> b -> b) -> b -> Vector v n a -> b
product :: Vector v n a -> a
$cproduct :: forall (v :: * -> *) (n :: Nat) a.
(Foldable v, Num a) =>
Vector v n a -> a
sum :: Vector v n a -> a
$csum :: forall (v :: * -> *) (n :: Nat) a.
(Foldable v, Num a) =>
Vector v n a -> a
minimum :: Vector v n a -> a
$cminimum :: forall (v :: * -> *) (n :: Nat) a.
(Foldable v, Ord a) =>
Vector v n a -> a
maximum :: Vector v n a -> a
$cmaximum :: forall (v :: * -> *) (n :: Nat) a.
(Foldable v, Ord a) =>
Vector v n a -> a
elem :: a -> Vector v n a -> Bool
$celem :: forall (v :: * -> *) (n :: Nat) a.
(Foldable v, Eq a) =>
a -> Vector v n a -> Bool
length :: Vector v n a -> Int
$clength :: forall (v :: * -> *) (n :: Nat) a.
Foldable v =>
Vector v n a -> Int
null :: Vector v n a -> Bool
$cnull :: forall (v :: * -> *) (n :: Nat) a.
Foldable v =>
Vector v n a -> Bool
toList :: Vector v n a -> [a]
$ctoList :: forall (v :: * -> *) (n :: Nat) a.
Foldable v =>
Vector v n a -> [a]
foldl1 :: (a -> a -> a) -> Vector v n a -> a
$cfoldl1 :: forall (v :: * -> *) (n :: Nat) a.
Foldable v =>
(a -> a -> a) -> Vector v n a -> a
foldr1 :: (a -> a -> a) -> Vector v n a -> a
$cfoldr1 :: forall (v :: * -> *) (n :: Nat) a.
Foldable v =>
(a -> a -> a) -> Vector v n a -> a
foldl' :: (b -> a -> b) -> b -> Vector v n a -> b
$cfoldl' :: forall (v :: * -> *) (n :: Nat) b a.
Foldable v =>
(b -> a -> b) -> b -> Vector v n a -> b
foldl :: (b -> a -> b) -> b -> Vector v n a -> b
$cfoldl :: forall (v :: * -> *) (n :: Nat) b a.
Foldable v =>
(b -> a -> b) -> b -> Vector v n a -> b
foldr' :: (a -> b -> b) -> b -> Vector v n a -> b
$cfoldr' :: forall (v :: * -> *) (n :: Nat) a b.
Foldable v =>
(a -> b -> b) -> b -> Vector v n a -> b
foldr :: (a -> b -> b) -> b -> Vector v n a -> b
$cfoldr :: forall (v :: * -> *) (n :: Nat) a b.
Foldable v =>
(a -> b -> b) -> b -> Vector v n a -> b
foldMap' :: (a -> m) -> Vector v n a -> m
$cfoldMap' :: forall (v :: * -> *) (n :: Nat) m a.
(Foldable v, Monoid m) =>
(a -> m) -> Vector v n a -> m
foldMap :: (a -> m) -> Vector v n a -> m
$cfoldMap :: forall (v :: * -> *) (n :: Nat) m a.
(Foldable v, Monoid m) =>
(a -> m) -> Vector v n a -> m
fold :: Vector v n m -> m
$cfold :: forall (v :: * -> *) (n :: Nat) m.
(Foldable v, Monoid m) =>
Vector v n m -> m
Foldable, Functor (Vector v n)
Foldable (Vector v n)
Functor (Vector v n)
-> Foldable (Vector v n)
-> (forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Vector v n a -> f (Vector v n b))
-> (forall (f :: * -> *) a.
Applicative f =>
Vector v n (f a) -> f (Vector v n a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Vector v n a -> m (Vector v n b))
-> (forall (m :: * -> *) a.
Monad m =>
Vector v n (m a) -> m (Vector v n a))
-> Traversable (Vector v n)
(a -> f b) -> Vector v n a -> f (Vector v n b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
Vector v n (m a) -> m (Vector v n a)
forall (f :: * -> *) a.
Applicative f =>
Vector v n (f a) -> f (Vector v n a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Vector v n a -> m (Vector v n b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Vector v n a -> f (Vector v n b)
forall (v :: * -> *) (n :: Nat).
Traversable v =>
Functor (Vector v n)
forall (v :: * -> *) (n :: Nat).
Traversable v =>
Foldable (Vector v n)
forall (v :: * -> *) (n :: Nat) (m :: * -> *) a.
(Traversable v, Monad m) =>
Vector v n (m a) -> m (Vector v n a)
forall (v :: * -> *) (n :: Nat) (f :: * -> *) a.
(Traversable v, Applicative f) =>
Vector v n (f a) -> f (Vector v n a)
forall (v :: * -> *) (n :: Nat) (m :: * -> *) a b.
(Traversable v, Monad m) =>
(a -> m b) -> Vector v n a -> m (Vector v n b)
forall (v :: * -> *) (n :: Nat) (f :: * -> *) a b.
(Traversable v, Applicative f) =>
(a -> f b) -> Vector v n a -> f (Vector v n b)
sequence :: Vector v n (m a) -> m (Vector v n a)
$csequence :: forall (v :: * -> *) (n :: Nat) (m :: * -> *) a.
(Traversable v, Monad m) =>
Vector v n (m a) -> m (Vector v n a)
mapM :: (a -> m b) -> Vector v n a -> m (Vector v n b)
$cmapM :: forall (v :: * -> *) (n :: Nat) (m :: * -> *) a b.
(Traversable v, Monad m) =>
(a -> m b) -> Vector v n a -> m (Vector v n b)
sequenceA :: Vector v n (f a) -> f (Vector v n a)
$csequenceA :: forall (v :: * -> *) (n :: Nat) (f :: * -> *) a.
(Traversable v, Applicative f) =>
Vector v n (f a) -> f (Vector v n a)
traverse :: (a -> f b) -> Vector v n a -> f (Vector v n b)
$ctraverse :: forall (v :: * -> *) (n :: Nat) (f :: * -> *) a b.
(Traversable v, Applicative f) =>
(a -> f b) -> Vector v n a -> f (Vector v n b)
$cp2Traversable :: forall (v :: * -> *) (n :: Nat).
Traversable v =>
Foldable (Vector v n)
$cp1Traversable :: forall (v :: * -> *) (n :: Nat).
Traversable v =>
Functor (Vector v n)
Traversable, Vector v n a -> ()
(Vector v n a -> ()) -> NFData (Vector v n a)
forall a. (a -> ()) -> NFData a
forall (v :: * -> *) (n :: Nat) a.
NFData (v a) =>
Vector v n a -> ()
rnf :: Vector v n a -> ()
$crnf :: forall (v :: * -> *) (n :: Nat) a.
NFData (v a) =>
Vector v n a -> ()
NFData
, (Int -> a -> ShowS)
-> ([a] -> ShowS) -> Int -> Vector v n a -> ShowS
(Int -> a -> ShowS) -> ([a] -> ShowS) -> [Vector v n a] -> ShowS
(forall a.
(Int -> a -> ShowS)
-> ([a] -> ShowS) -> Int -> Vector v n a -> ShowS)
-> (forall a.
(Int -> a -> ShowS) -> ([a] -> ShowS) -> [Vector v n a] -> ShowS)
-> Show1 (Vector v n)
forall a.
(Int -> a -> ShowS)
-> ([a] -> ShowS) -> Int -> Vector v n a -> ShowS
forall a.
(Int -> a -> ShowS) -> ([a] -> ShowS) -> [Vector v n a] -> ShowS
forall (f :: * -> *).
(forall a.
(Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS)
-> (forall a.
(Int -> a -> ShowS) -> ([a] -> ShowS) -> [f a] -> ShowS)
-> Show1 f
forall (v :: * -> *) (n :: Nat) a.
Show1 v =>
(Int -> a -> ShowS)
-> ([a] -> ShowS) -> Int -> Vector v n a -> ShowS
forall (v :: * -> *) (n :: Nat) a.
Show1 v =>
(Int -> a -> ShowS) -> ([a] -> ShowS) -> [Vector v n a] -> ShowS
liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Vector v n a] -> ShowS
$cliftShowList :: forall (v :: * -> *) (n :: Nat) a.
Show1 v =>
(Int -> a -> ShowS) -> ([a] -> ShowS) -> [Vector v n a] -> ShowS
liftShowsPrec :: (Int -> a -> ShowS)
-> ([a] -> ShowS) -> Int -> Vector v n a -> ShowS
$cliftShowsPrec :: forall (v :: * -> *) (n :: Nat) a.
Show1 v =>
(Int -> a -> ShowS)
-> ([a] -> ShowS) -> Int -> Vector v n a -> ShowS
Show1, (a -> b -> Bool) -> Vector v n a -> Vector v n b -> Bool
(forall a b.
(a -> b -> Bool) -> Vector v n a -> Vector v n b -> Bool)
-> Eq1 (Vector v n)
forall a b.
(a -> b -> Bool) -> Vector v n a -> Vector v n b -> Bool
forall (f :: * -> *).
(forall a b. (a -> b -> Bool) -> f a -> f b -> Bool) -> Eq1 f
forall (v :: * -> *) (n :: Nat) a b.
Eq1 v =>
(a -> b -> Bool) -> Vector v n a -> Vector v n b -> Bool
liftEq :: (a -> b -> Bool) -> Vector v n a -> Vector v n b -> Bool
$cliftEq :: forall (v :: * -> *) (n :: Nat) a b.
Eq1 v =>
(a -> b -> Bool) -> Vector v n a -> Vector v n b -> Bool
Eq1, Eq1 (Vector v n)
Eq1 (Vector v n)
-> (forall a b.
(a -> b -> Ordering) -> Vector v n a -> Vector v n b -> Ordering)
-> Ord1 (Vector v n)
(a -> b -> Ordering) -> Vector v n a -> Vector v n b -> Ordering
forall a b.
(a -> b -> Ordering) -> Vector v n a -> Vector v n b -> Ordering
forall (f :: * -> *).
Eq1 f
-> (forall a b. (a -> b -> Ordering) -> f a -> f b -> Ordering)
-> Ord1 f
forall (v :: * -> *) (n :: Nat). Ord1 v => Eq1 (Vector v n)
forall (v :: * -> *) (n :: Nat) a b.
Ord1 v =>
(a -> b -> Ordering) -> Vector v n a -> Vector v n b -> Ordering
liftCompare :: (a -> b -> Ordering) -> Vector v n a -> Vector v n b -> Ordering
$cliftCompare :: forall (v :: * -> *) (n :: Nat) a b.
Ord1 v =>
(a -> b -> Ordering) -> Vector v n a -> Vector v n b -> Ordering
$cp1Ord1 :: forall (v :: * -> *) (n :: Nat). Ord1 v => Eq1 (Vector v n)
Ord1
, Typeable (Vector v n a)
DataType
Constr
Typeable (Vector v n a)
-> (forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Vector v n a -> c (Vector v n a))
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Vector v n a))
-> (Vector v n a -> Constr)
-> (Vector v n a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Vector v n a)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Vector v n a)))
-> ((forall b. Data b => b -> b) -> Vector v n a -> Vector v n a)
-> (forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Vector v n a -> r)
-> (forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Vector v n a -> r)
-> (forall u. (forall d. Data d => d -> u) -> Vector v n a -> [u])
-> (forall u.
Int -> (forall d. Data d => d -> u) -> Vector v n a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Vector v n a -> m (Vector v n a))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Vector v n a -> m (Vector v n a))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Vector v n a -> m (Vector v n a))
-> Data (Vector v n a)
Vector v n a -> DataType
Vector v n a -> Constr
(forall b. Data b => b -> b) -> Vector v n a -> Vector v n a
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Vector v n a -> c (Vector v n a)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Vector v n 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) -> Vector v n a -> u
forall u. (forall d. Data d => d -> u) -> Vector v n a -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Vector v n a -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Vector v n a -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Vector v n a -> m (Vector v n a)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Vector v n a -> m (Vector v n a)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Vector v n a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Vector v n a -> c (Vector v n a)
forall (v :: * -> *) (n :: Nat) a.
(KnownNat n, Typeable v, Typeable a, Data (v a)) =>
Typeable (Vector v n a)
forall (v :: * -> *) (n :: Nat) a.
(KnownNat n, Typeable v, Typeable a, Data (v a)) =>
Vector v n a -> DataType
forall (v :: * -> *) (n :: Nat) a.
(KnownNat n, Typeable v, Typeable a, Data (v a)) =>
Vector v n a -> Constr
forall (v :: * -> *) (n :: Nat) a.
(KnownNat n, Typeable v, Typeable a, Data (v a)) =>
(forall b. Data b => b -> b) -> Vector v n a -> Vector v n a
forall (v :: * -> *) (n :: Nat) a u.
(KnownNat n, Typeable v, Typeable a, Data (v a)) =>
Int -> (forall d. Data d => d -> u) -> Vector v n a -> u
forall (v :: * -> *) (n :: Nat) a u.
(KnownNat n, Typeable v, Typeable a, Data (v a)) =>
(forall d. Data d => d -> u) -> Vector v n a -> [u]
forall (v :: * -> *) (n :: Nat) a r r'.
(KnownNat n, Typeable v, Typeable a, Data (v a)) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Vector v n a -> r
forall (v :: * -> *) (n :: Nat) a r r'.
(KnownNat n, Typeable v, Typeable a, Data (v a)) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Vector v n a -> r
forall (v :: * -> *) (n :: Nat) a (m :: * -> *).
(KnownNat n, Typeable v, Typeable a, Data (v a), Monad m) =>
(forall d. Data d => d -> m d) -> Vector v n a -> m (Vector v n a)
forall (v :: * -> *) (n :: Nat) a (m :: * -> *).
(KnownNat n, Typeable v, Typeable a, Data (v a), MonadPlus m) =>
(forall d. Data d => d -> m d) -> Vector v n a -> m (Vector v n a)
forall (v :: * -> *) (n :: Nat) a (c :: * -> *).
(KnownNat n, Typeable v, Typeable a, Data (v a)) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Vector v n a)
forall (v :: * -> *) (n :: Nat) a (c :: * -> *).
(KnownNat n, Typeable v, Typeable a, Data (v a)) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Vector v n a -> c (Vector v n a)
forall (v :: * -> *) (n :: Nat) a (t :: * -> *) (c :: * -> *).
(KnownNat n, Typeable v, Typeable a, Data (v a), Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Vector v n a))
forall (v :: * -> *) (n :: Nat) a (t :: * -> * -> *) (c :: * -> *).
(KnownNat n, Typeable v, Typeable a, Data (v a), Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Vector v n a))
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Vector v n a))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Vector v n a))
$cVector :: Constr
$tVector :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> Vector v n a -> m (Vector v n a)
$cgmapMo :: forall (v :: * -> *) (n :: Nat) a (m :: * -> *).
(KnownNat n, Typeable v, Typeable a, Data (v a), MonadPlus m) =>
(forall d. Data d => d -> m d) -> Vector v n a -> m (Vector v n a)
gmapMp :: (forall d. Data d => d -> m d) -> Vector v n a -> m (Vector v n a)
$cgmapMp :: forall (v :: * -> *) (n :: Nat) a (m :: * -> *).
(KnownNat n, Typeable v, Typeable a, Data (v a), MonadPlus m) =>
(forall d. Data d => d -> m d) -> Vector v n a -> m (Vector v n a)
gmapM :: (forall d. Data d => d -> m d) -> Vector v n a -> m (Vector v n a)
$cgmapM :: forall (v :: * -> *) (n :: Nat) a (m :: * -> *).
(KnownNat n, Typeable v, Typeable a, Data (v a), Monad m) =>
(forall d. Data d => d -> m d) -> Vector v n a -> m (Vector v n a)
gmapQi :: Int -> (forall d. Data d => d -> u) -> Vector v n a -> u
$cgmapQi :: forall (v :: * -> *) (n :: Nat) a u.
(KnownNat n, Typeable v, Typeable a, Data (v a)) =>
Int -> (forall d. Data d => d -> u) -> Vector v n a -> u
gmapQ :: (forall d. Data d => d -> u) -> Vector v n a -> [u]
$cgmapQ :: forall (v :: * -> *) (n :: Nat) a u.
(KnownNat n, Typeable v, Typeable a, Data (v a)) =>
(forall d. Data d => d -> u) -> Vector v n a -> [u]
gmapQr :: (r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Vector v n a -> r
$cgmapQr :: forall (v :: * -> *) (n :: Nat) a r r'.
(KnownNat n, Typeable v, Typeable a, Data (v a)) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Vector v n a -> r
gmapQl :: (r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Vector v n a -> r
$cgmapQl :: forall (v :: * -> *) (n :: Nat) a r r'.
(KnownNat n, Typeable v, Typeable a, Data (v a)) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Vector v n a -> r
gmapT :: (forall b. Data b => b -> b) -> Vector v n a -> Vector v n a
$cgmapT :: forall (v :: * -> *) (n :: Nat) a.
(KnownNat n, Typeable v, Typeable a, Data (v a)) =>
(forall b. Data b => b -> b) -> Vector v n a -> Vector v n a
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Vector v n a))
$cdataCast2 :: forall (v :: * -> *) (n :: Nat) a (t :: * -> * -> *) (c :: * -> *).
(KnownNat n, Typeable v, Typeable a, Data (v a), Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Vector v n a))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (Vector v n a))
$cdataCast1 :: forall (v :: * -> *) (n :: Nat) a (t :: * -> *) (c :: * -> *).
(KnownNat n, Typeable v, Typeable a, Data (v a), Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Vector v n a))
dataTypeOf :: Vector v n a -> DataType
$cdataTypeOf :: forall (v :: * -> *) (n :: Nat) a.
(KnownNat n, Typeable v, Typeable a, Data (v a)) =>
Vector v n a -> DataType
toConstr :: Vector v n a -> Constr
$ctoConstr :: forall (v :: * -> *) (n :: Nat) a.
(KnownNat n, Typeable v, Typeable a, Data (v a)) =>
Vector v n a -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Vector v n a)
$cgunfold :: forall (v :: * -> *) (n :: Nat) a (c :: * -> *).
(KnownNat n, Typeable v, Typeable a, Data (v a)) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Vector v n a)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Vector v n a -> c (Vector v n a)
$cgfoldl :: forall (v :: * -> *) (n :: Nat) a (c :: * -> *).
(KnownNat n, Typeable v, Typeable a, Data (v a)) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Vector v n a -> c (Vector v n a)
$cp1Data :: forall (v :: * -> *) (n :: Nat) a.
(KnownNat n, Typeable v, Typeable a, Data (v a)) =>
Typeable (Vector v n a)
Data, Typeable
)
instance (Ix a, Ord (v a), VG.Vector v a) => Ix (Vector v n a) where
range :: (Vector v n a, Vector v n a) -> [Vector v n a]
range (Vector v a
l, Vector v a
u) = v a -> Vector v n a
forall (v :: * -> *) (n :: Nat) a. v a -> Vector v n a
Vector (v a -> Vector v n a) -> [v a] -> [Vector v n a]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Vector [a] -> [v a]
forall (v :: * -> *) a. Vector v a => Vector [a] -> [v a]
enumerate Vector [a]
ranges
where
ranges :: Vector [a]
ranges = (a -> a -> [a]) -> Vector a -> Vector a -> Vector [a]
forall a b c. (a -> b -> c) -> Vector a -> Vector b -> Vector c
V.zipWith (((a, a) -> [a]) -> a -> a -> [a]
forall a b c. ((a, b) -> c) -> a -> b -> c
curry (a, a) -> [a]
forall a. Ix a => (a, a) -> [a]
range) Vector a
lc Vector a
uc
lc :: Vector a
lc = v a -> Vector a
forall (v :: * -> *) a (w :: * -> *).
(Vector v a, Vector w a) =>
v a -> w a
VG.convert v a
l
uc :: Vector a
uc = v a -> Vector a
forall (v :: * -> *) a (w :: * -> *).
(Vector v a, Vector w a) =>
v a -> w a
VG.convert v a
u
enumerate :: Vector [a] -> [v a]
enumerate Vector [a]
v | Vector [a] -> Bool
forall a. Vector a -> Bool
V.null Vector [a]
v = [v a
forall (v :: * -> *) a. Vector v a => v a
VG.empty]
| Bool
otherwise = ([a] -> v a) -> [[a]] -> [v a]
forall a b. (a -> b) -> [a] -> [b]
map [a] -> v a
forall (v :: * -> *) a. Vector v a => [a] -> v a
VG.fromList ([[a]] -> [v a]) -> [[a]] -> [v a]
forall a b. (a -> b) -> a -> b
$ [[a]] -> [[a]]
forall a. [[a]] -> [[a]]
enumerate' (Vector [a] -> [[a]]
forall (v :: * -> *) a. Vector v a => v a -> [a]
VG.toList Vector [a]
v)
enumerate' :: [[a]] -> [[a]]
enumerate' [] = [[]]
enumerate' ([a]
xs : [[a]]
xss) = [ a
x a -> [a] -> [a]
forall a. a -> [a] -> [a]
: [a]
xs' | a
x <- [a]
xs, [a]
xs' <- [[a]] -> [[a]]
enumerate' [[a]]
xss ]
unsafeIndex :: (Vector v n a, Vector v n a) -> Vector v n a -> Int
unsafeIndex (Vector v a
l, Vector v a
u) (Vector v a
i) = (Int -> (Int, Int) -> Int) -> Int -> Vector (Int, Int) -> Int
forall a b. (a -> b -> a) -> a -> Vector b -> a
V.foldl' Int -> (Int, Int) -> Int
forall a. Num a => a -> (a, a) -> a
f Int
0 Vector (Int, Int)
v
where
f :: a -> (a, a) -> a
f a
acc (a
index', a
rangeSize') = a
acc a -> a -> a
forall a. Num a => a -> a -> a
* a
rangeSize' a -> a -> a
forall a. Num a => a -> a -> a
+ a
index'
v :: Vector (Int, Int)
v = (a -> a -> a -> (Int, Int))
-> Vector a -> Vector a -> Vector a -> Vector (Int, Int)
forall a b c d.
(a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector d
V.zipWith3 a -> a -> a -> (Int, Int)
forall a. Ix a => a -> a -> a -> (Int, Int)
indexAndRangeSize Vector a
lc Vector a
uc Vector a
ic
(Vector a
lc, Vector a
uc, Vector a
ic) = v a -> v a -> v a -> (Vector a, Vector a, Vector a)
forall (v1 :: * -> *) a (w1 :: * -> *) (v2 :: * -> *) b
(w2 :: * -> *) (v3 :: * -> *) c (w3 :: * -> *).
(Vector v1 a, Vector w1 a, Vector v2 b, Vector w2 b, Vector v3 c,
Vector w3 c) =>
v1 a -> v2 b -> v3 c -> (w1 a, w2 b, w3 c)
convert3 v a
l v a
u v a
i
indexAndRangeSize :: a -> a -> a -> (Int, Int)
indexAndRangeSize a
l' a
u' a
i' =
let b' :: (a, a)
b' = (a
l', a
u') in ((a, a) -> a -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a, a)
b' a
i', (a, a) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a, a)
b')
inRange :: (Vector v n a, Vector v n a) -> Vector v n a -> Bool
inRange (Vector v a
l, Vector v a
u) (Vector v a
i) = Vector Bool -> Bool
V.and
(Vector Bool -> Bool) -> Vector Bool -> Bool
forall a b. (a -> b) -> a -> b
$ (a -> a -> a -> Bool)
-> Vector a -> Vector a -> Vector a -> Vector Bool
forall a b c d.
(a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector d
V.zipWith3 (((a, a) -> a -> Bool) -> a -> a -> a -> Bool
forall a b c. ((a, b) -> c) -> a -> b -> c
curry (a, a) -> a -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange) Vector a
lc Vector a
uc Vector a
ic
where (Vector a
lc, Vector a
uc, Vector a
ic) = v a -> v a -> v a -> (Vector a, Vector a, Vector a)
forall (v1 :: * -> *) a (w1 :: * -> *) (v2 :: * -> *) b
(w2 :: * -> *) (v3 :: * -> *) c (w3 :: * -> *).
(Vector v1 a, Vector w1 a, Vector v2 b, Vector w2 b, Vector v3 c,
Vector w3 c) =>
v1 a -> v2 b -> v3 c -> (w1 a, w2 b, w3 c)
convert3 v a
l v a
u v a
i
{-# INLINE convert3 #-}
convert3
:: ( VG.Vector v1 a
, VG.Vector w1 a
, VG.Vector v2 b
, VG.Vector w2 b
, VG.Vector v3 c
, VG.Vector w3 c
)
=> v1 a
-> v2 b
-> v3 c
-> (w1 a, w2 b, w3 c)
convert3 :: v1 a -> v2 b -> v3 c -> (w1 a, w2 b, w3 c)
convert3 v1 a
v1 v2 b
v2 v3 c
v3 = (v1 a -> w1 a
forall (v :: * -> *) a (w :: * -> *).
(Vector v a, Vector w a) =>
v a -> w a
VG.convert v1 a
v1, v2 b -> w2 b
forall (v :: * -> *) a (w :: * -> *).
(Vector v a, Vector w a) =>
v a -> w a
VG.convert v2 b
v2, v3 c -> w3 c
forall (v :: * -> *) a (w :: * -> *).
(Vector v a, Vector w a) =>
v a -> w a
VG.convert v3 c
v3)