{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveLift #-}
#ifndef MIN_VERSION_hashable
#define MIN_VERSION_hashable(x,y,z) 1
#endif
#ifndef MIN_VERSION_vector
#define MIN_VERSION_vector(x,y,z) 1
#endif
#ifndef MIN_VERSION_transformers
#define MIN_VERSION_transformers(x,y,z) 1
#endif
#ifndef MIN_VERSION_base
#define MIN_VERSION_base(x,y,z) 1
#endif
module Linear.V1
( V1(..)
, R1(..)
, ex
) where
import Control.Applicative
import Control.DeepSeq (NFData)
import Control.Monad (liftM)
import Control.Monad.Fix
import Control.Monad.Zip
import Control.Lens as Lens
import Data.Binary as Binary
import Data.Bytes.Serial
import Data.Serialize as Cereal
import Data.Data
import Data.Distributive
import Data.Foldable
import qualified Data.Foldable.WithIndex as WithIndex
import Data.Functor.Bind
import Data.Functor.Classes
import Data.Functor.Rep
import qualified Data.Functor.WithIndex as WithIndex
import Data.Hashable
import Data.Hashable.Lifted
import Data.Semigroup.Foldable
import qualified Data.Traversable.WithIndex as WithIndex
import qualified Data.Vector as V
import Linear.V
import Foreign.Storable (Storable)
import GHC.Arr (Ix(..))
import GHC.Generics (Generic, Generic1)
#if defined(MIN_VERSION_template_haskell)
import Language.Haskell.TH.Syntax (Lift)
#endif
import Linear.Metric
import Linear.Epsilon
import Linear.Vector
import Prelude hiding (sum)
import System.Random (Random(..))
#if !(MIN_VERSION_base(4,11,0))
import Data.Semigroup
#endif
import qualified Data.Vector.Generic.Mutable as M
import qualified Data.Vector.Generic as G
import qualified Data.Vector.Unboxed.Base as U
newtype V1 a = V1 a
deriving (V1 a -> V1 a -> Bool
(V1 a -> V1 a -> Bool) -> (V1 a -> V1 a -> Bool) -> Eq (V1 a)
forall a. Eq a => V1 a -> V1 a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: forall a. Eq a => V1 a -> V1 a -> Bool
== :: V1 a -> V1 a -> Bool
$c/= :: forall a. Eq a => V1 a -> V1 a -> Bool
/= :: V1 a -> V1 a -> Bool
Eq,Eq (V1 a)
Eq (V1 a) =>
(V1 a -> V1 a -> Ordering)
-> (V1 a -> V1 a -> Bool)
-> (V1 a -> V1 a -> Bool)
-> (V1 a -> V1 a -> Bool)
-> (V1 a -> V1 a -> Bool)
-> (V1 a -> V1 a -> V1 a)
-> (V1 a -> V1 a -> V1 a)
-> Ord (V1 a)
V1 a -> V1 a -> Bool
V1 a -> V1 a -> Ordering
V1 a -> V1 a -> V1 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 a. Ord a => Eq (V1 a)
forall a. Ord a => V1 a -> V1 a -> Bool
forall a. Ord a => V1 a -> V1 a -> Ordering
forall a. Ord a => V1 a -> V1 a -> V1 a
$ccompare :: forall a. Ord a => V1 a -> V1 a -> Ordering
compare :: V1 a -> V1 a -> Ordering
$c< :: forall a. Ord a => V1 a -> V1 a -> Bool
< :: V1 a -> V1 a -> Bool
$c<= :: forall a. Ord a => V1 a -> V1 a -> Bool
<= :: V1 a -> V1 a -> Bool
$c> :: forall a. Ord a => V1 a -> V1 a -> Bool
> :: V1 a -> V1 a -> Bool
$c>= :: forall a. Ord a => V1 a -> V1 a -> Bool
>= :: V1 a -> V1 a -> Bool
$cmax :: forall a. Ord a => V1 a -> V1 a -> V1 a
max :: V1 a -> V1 a -> V1 a
$cmin :: forall a. Ord a => V1 a -> V1 a -> V1 a
min :: V1 a -> V1 a -> V1 a
Ord,Int -> V1 a -> ShowS
[V1 a] -> ShowS
V1 a -> String
(Int -> V1 a -> ShowS)
-> (V1 a -> String) -> ([V1 a] -> ShowS) -> Show (V1 a)
forall a. Show a => Int -> V1 a -> ShowS
forall a. Show a => [V1 a] -> ShowS
forall a. Show a => V1 a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: forall a. Show a => Int -> V1 a -> ShowS
showsPrec :: Int -> V1 a -> ShowS
$cshow :: forall a. Show a => V1 a -> String
show :: V1 a -> String
$cshowList :: forall a. Show a => [V1 a] -> ShowS
showList :: [V1 a] -> ShowS
Show,ReadPrec [V1 a]
ReadPrec (V1 a)
Int -> ReadS (V1 a)
ReadS [V1 a]
(Int -> ReadS (V1 a))
-> ReadS [V1 a]
-> ReadPrec (V1 a)
-> ReadPrec [V1 a]
-> Read (V1 a)
forall a. Read a => ReadPrec [V1 a]
forall a. Read a => ReadPrec (V1 a)
forall a. Read a => Int -> ReadS (V1 a)
forall a. Read a => ReadS [V1 a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: forall a. Read a => Int -> ReadS (V1 a)
readsPrec :: Int -> ReadS (V1 a)
$creadList :: forall a. Read a => ReadS [V1 a]
readList :: ReadS [V1 a]
$creadPrec :: forall a. Read a => ReadPrec (V1 a)
readPrec :: ReadPrec (V1 a)
$creadListPrec :: forall a. Read a => ReadPrec [V1 a]
readListPrec :: ReadPrec [V1 a]
Read,Typeable (V1 a)
Typeable (V1 a) =>
(forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> V1 a -> c (V1 a))
-> (forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (V1 a))
-> (V1 a -> Constr)
-> (V1 a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (V1 a)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (V1 a)))
-> ((forall b. Data b => b -> b) -> V1 a -> V1 a)
-> (forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> V1 a -> r)
-> (forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> V1 a -> r)
-> (forall u. (forall d. Data d => d -> u) -> V1 a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> V1 a -> u)
-> (forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> V1 a -> m (V1 a))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> V1 a -> m (V1 a))
-> (forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> V1 a -> m (V1 a))
-> Data (V1 a)
V1 a -> Constr
V1 a -> DataType
(forall b. Data b => b -> b) -> V1 a -> V1 a
forall a. Data a => Typeable (V1 a)
forall a. Data a => V1 a -> Constr
forall a. Data a => V1 a -> DataType
forall a. Data a => (forall b. Data b => b -> b) -> V1 a -> V1 a
forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> V1 a -> u
forall a u. Data a => (forall d. Data d => d -> u) -> V1 a -> [u]
forall a r r'.
Data a =>
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> V1 a -> r
forall a r r'.
Data a =>
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> V1 a -> r
forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> V1 a -> m (V1 a)
forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> V1 a -> m (V1 a)
forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (V1 a)
forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> V1 a -> c (V1 a)
forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (V1 a))
forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (V1 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) -> V1 a -> u
forall u. (forall d. Data d => d -> u) -> V1 a -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> V1 a -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> V1 a -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> V1 a -> m (V1 a)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> V1 a -> m (V1 a)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (V1 a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> V1 a -> c (V1 a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (V1 a))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (V1 a))
$cgfoldl :: forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> V1 a -> c (V1 a)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> V1 a -> c (V1 a)
$cgunfold :: forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (V1 a)
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (V1 a)
$ctoConstr :: forall a. Data a => V1 a -> Constr
toConstr :: V1 a -> Constr
$cdataTypeOf :: forall a. Data a => V1 a -> DataType
dataTypeOf :: V1 a -> DataType
$cdataCast1 :: forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (V1 a))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (V1 a))
$cdataCast2 :: forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (V1 a))
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (V1 a))
$cgmapT :: forall a. Data a => (forall b. Data b => b -> b) -> V1 a -> V1 a
gmapT :: (forall b. Data b => b -> b) -> V1 a -> V1 a
$cgmapQl :: forall a r r'.
Data a =>
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> V1 a -> r
gmapQl :: forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> V1 a -> r
$cgmapQr :: forall a r r'.
Data a =>
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> V1 a -> r
gmapQr :: forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> V1 a -> r
$cgmapQ :: forall a u. Data a => (forall d. Data d => d -> u) -> V1 a -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> V1 a -> [u]
$cgmapQi :: forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> V1 a -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> V1 a -> u
$cgmapM :: forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> V1 a -> m (V1 a)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> V1 a -> m (V1 a)
$cgmapMp :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> V1 a -> m (V1 a)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> V1 a -> m (V1 a)
$cgmapMo :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> V1 a -> m (V1 a)
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> V1 a -> m (V1 a)
Data,
(forall a b. (a -> b) -> V1 a -> V1 b)
-> (forall a b. a -> V1 b -> V1 a) -> Functor V1
forall a b. a -> V1 b -> V1 a
forall a b. (a -> b) -> V1 a -> V1 b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
$cfmap :: forall a b. (a -> b) -> V1 a -> V1 b
fmap :: forall a b. (a -> b) -> V1 a -> V1 b
$c<$ :: forall a b. a -> V1 b -> V1 a
<$ :: forall a b. a -> V1 b -> V1 a
Functor,Functor V1
Foldable V1
(Functor V1, Foldable V1) =>
(forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> V1 a -> f (V1 b))
-> (forall (f :: * -> *) a. Applicative f => V1 (f a) -> f (V1 a))
-> (forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> V1 a -> m (V1 b))
-> (forall (m :: * -> *) a. Monad m => V1 (m a) -> m (V1 a))
-> Traversable V1
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 => V1 (m a) -> m (V1 a)
forall (f :: * -> *) a. Applicative f => V1 (f a) -> f (V1 a)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> V1 a -> m (V1 b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> V1 a -> f (V1 b)
$ctraverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> V1 a -> f (V1 b)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> V1 a -> f (V1 b)
$csequenceA :: forall (f :: * -> *) a. Applicative f => V1 (f a) -> f (V1 a)
sequenceA :: forall (f :: * -> *) a. Applicative f => V1 (f a) -> f (V1 a)
$cmapM :: forall (m :: * -> *) a b. Monad m => (a -> m b) -> V1 a -> m (V1 b)
mapM :: forall (m :: * -> *) a b. Monad m => (a -> m b) -> V1 a -> m (V1 b)
$csequence :: forall (m :: * -> *) a. Monad m => V1 (m a) -> m (V1 a)
sequence :: forall (m :: * -> *) a. Monad m => V1 (m a) -> m (V1 a)
Traversable,
Num (V1 a)
Num (V1 a) => (V1 a -> Bool) -> Epsilon (V1 a)
V1 a -> Bool
forall a. Num a => (a -> Bool) -> Epsilon a
forall a. Epsilon a => Num (V1 a)
forall a. Epsilon a => V1 a -> Bool
$cnearZero :: forall a. Epsilon a => V1 a -> Bool
nearZero :: V1 a -> Bool
Epsilon,Ptr (V1 a) -> IO (V1 a)
Ptr (V1 a) -> Int -> IO (V1 a)
Ptr (V1 a) -> Int -> V1 a -> IO ()
Ptr (V1 a) -> V1 a -> IO ()
V1 a -> Int
(V1 a -> Int)
-> (V1 a -> Int)
-> (Ptr (V1 a) -> Int -> IO (V1 a))
-> (Ptr (V1 a) -> Int -> V1 a -> IO ())
-> (forall b. Ptr b -> Int -> IO (V1 a))
-> (forall b. Ptr b -> Int -> V1 a -> IO ())
-> (Ptr (V1 a) -> IO (V1 a))
-> (Ptr (V1 a) -> V1 a -> IO ())
-> Storable (V1 a)
forall b. Ptr b -> Int -> IO (V1 a)
forall b. Ptr b -> Int -> V1 a -> IO ()
forall a. Storable a => Ptr (V1 a) -> IO (V1 a)
forall a. Storable a => Ptr (V1 a) -> Int -> IO (V1 a)
forall a. Storable a => Ptr (V1 a) -> Int -> V1 a -> IO ()
forall a. Storable a => Ptr (V1 a) -> V1 a -> IO ()
forall a. Storable a => V1 a -> Int
forall a b. Storable a => Ptr b -> Int -> IO (V1 a)
forall a b. Storable a => Ptr b -> Int -> V1 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
$csizeOf :: forall a. Storable a => V1 a -> Int
sizeOf :: V1 a -> Int
$calignment :: forall a. Storable a => V1 a -> Int
alignment :: V1 a -> Int
$cpeekElemOff :: forall a. Storable a => Ptr (V1 a) -> Int -> IO (V1 a)
peekElemOff :: Ptr (V1 a) -> Int -> IO (V1 a)
$cpokeElemOff :: forall a. Storable a => Ptr (V1 a) -> Int -> V1 a -> IO ()
pokeElemOff :: Ptr (V1 a) -> Int -> V1 a -> IO ()
$cpeekByteOff :: forall a b. Storable a => Ptr b -> Int -> IO (V1 a)
peekByteOff :: forall b. Ptr b -> Int -> IO (V1 a)
$cpokeByteOff :: forall a b. Storable a => Ptr b -> Int -> V1 a -> IO ()
pokeByteOff :: forall b. Ptr b -> Int -> V1 a -> IO ()
$cpeek :: forall a. Storable a => Ptr (V1 a) -> IO (V1 a)
peek :: Ptr (V1 a) -> IO (V1 a)
$cpoke :: forall a. Storable a => Ptr (V1 a) -> V1 a -> IO ()
poke :: Ptr (V1 a) -> V1 a -> IO ()
Storable,V1 a -> ()
(V1 a -> ()) -> NFData (V1 a)
forall a. NFData a => V1 a -> ()
forall a. (a -> ()) -> NFData a
$crnf :: forall a. NFData a => V1 a -> ()
rnf :: V1 a -> ()
NFData
,(forall x. V1 a -> Rep (V1 a) x)
-> (forall x. Rep (V1 a) x -> V1 a) -> Generic (V1 a)
forall x. Rep (V1 a) x -> V1 a
forall x. V1 a -> Rep (V1 a) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a x. Rep (V1 a) x -> V1 a
forall a x. V1 a -> Rep (V1 a) x
$cfrom :: forall a x. V1 a -> Rep (V1 a) x
from :: forall x. V1 a -> Rep (V1 a) x
$cto :: forall a x. Rep (V1 a) x -> V1 a
to :: forall x. Rep (V1 a) x -> V1 a
Generic,(forall a. V1 a -> Rep1 V1 a)
-> (forall a. Rep1 V1 a -> V1 a) -> Generic1 V1
forall a. Rep1 V1 a -> V1 a
forall a. V1 a -> Rep1 V1 a
forall k (f :: k -> *).
(forall (a :: k). f a -> Rep1 f a)
-> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f
$cfrom1 :: forall a. V1 a -> Rep1 V1 a
from1 :: forall a. V1 a -> Rep1 V1 a
$cto1 :: forall a. Rep1 V1 a -> V1 a
to1 :: forall a. Rep1 V1 a -> V1 a
Generic1
#if defined(MIN_VERSION_template_haskell)
,(forall (m :: * -> *). Quote m => V1 a -> m Exp)
-> (forall (m :: * -> *). Quote m => V1 a -> Code m (V1 a))
-> Lift (V1 a)
forall a (m :: * -> *). (Lift a, Quote m) => V1 a -> m Exp
forall a (m :: * -> *). (Lift a, Quote m) => V1 a -> Code m (V1 a)
forall t.
(forall (m :: * -> *). Quote m => t -> m Exp)
-> (forall (m :: * -> *). Quote m => t -> Code m t) -> Lift t
forall (m :: * -> *). Quote m => V1 a -> m Exp
forall (m :: * -> *). Quote m => V1 a -> Code m (V1 a)
$clift :: forall a (m :: * -> *). (Lift a, Quote m) => V1 a -> m Exp
lift :: forall (m :: * -> *). Quote m => V1 a -> m Exp
$cliftTyped :: forall a (m :: * -> *). (Lift a, Quote m) => V1 a -> Code m (V1 a)
liftTyped :: forall (m :: * -> *). Quote m => V1 a -> Code m (V1 a)
Lift
#endif
)
instance Foldable V1 where
foldMap :: forall m a. Monoid m => (a -> m) -> V1 a -> m
foldMap a -> m
f (V1 a
a) = a -> m
f a
a
#if MIN_VERSION_base(4,13,0)
foldMap' :: forall m a. Monoid m => (a -> m) -> V1 a -> m
foldMap' a -> m
f (V1 a
a) = a -> m
f a
a
#endif
null :: forall a. V1 a -> Bool
null V1 a
_ = Bool
False
length :: forall a. V1 a -> Int
length V1 a
_ = Int
1
instance Finite V1 where
type Size V1 = 1
toV :: forall a. V1 a -> V (Size V1) a
toV (V1 a
a) = Vector a -> V 1 a
forall {k} (n :: k) a. Vector a -> V n a
V (a -> Vector a
forall a. a -> Vector a
V.singleton a
a)
fromV :: forall a. V (Size V1) a -> V1 a
fromV (V Vector a
v) = a -> V1 a
forall a. a -> V1 a
V1 (Vector a
v Vector a -> Int -> a
forall a. Vector a -> Int -> a
V.! Int
0)
instance Foldable1 V1 where
foldMap1 :: forall m a. Semigroup m => (a -> m) -> V1 a -> m
foldMap1 a -> m
f (V1 a
a) = a -> m
f a
a
{-# INLINE foldMap1 #-}
instance Traversable1 V1 where
traverse1 :: forall (f :: * -> *) a b. Apply f => (a -> f b) -> V1 a -> f (V1 b)
traverse1 a -> f b
f (V1 a
a) = b -> V1 b
forall a. a -> V1 a
V1 (b -> V1 b) -> f b -> f (V1 b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f b
f a
a
{-# INLINE traverse1 #-}
instance Apply V1 where
V1 a -> b
f <.> :: forall a b. V1 (a -> b) -> V1 a -> V1 b
<.> V1 a
x = b -> V1 b
forall a. a -> V1 a
V1 (a -> b
f a
x)
{-# INLINE (<.>) #-}
instance Applicative V1 where
pure :: forall a. a -> V1 a
pure = a -> V1 a
forall a. a -> V1 a
V1
{-# INLINE pure #-}
V1 a -> b
f <*> :: forall a b. V1 (a -> b) -> V1 a -> V1 b
<*> V1 a
x = b -> V1 b
forall a. a -> V1 a
V1 (a -> b
f a
x)
{-# INLINE (<*>) #-}
instance Additive V1 where
zero :: forall a. Num a => V1 a
zero = a -> V1 a
forall a. a -> V1 a
forall (f :: * -> *) a. Applicative f => a -> f a
pure a
0
{-# INLINE zero #-}
liftU2 :: forall a. (a -> a -> a) -> V1 a -> V1 a -> V1 a
liftU2 = (a -> a -> a) -> V1 a -> V1 a -> V1 a
forall a b c. (a -> b -> c) -> V1 a -> V1 b -> V1 c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2
{-# INLINE liftU2 #-}
liftI2 :: forall a b c. (a -> b -> c) -> V1 a -> V1 b -> V1 c
liftI2 = (a -> b -> c) -> V1 a -> V1 b -> V1 c
forall a b c. (a -> b -> c) -> V1 a -> V1 b -> V1 c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2
{-# INLINE liftI2 #-}
instance Bind V1 where
V1 a
a >>- :: forall a b. V1 a -> (a -> V1 b) -> V1 b
>>- a -> V1 b
f = a -> V1 b
f a
a
{-# INLINE (>>-) #-}
instance Monad V1 where
#if !(MIN_VERSION_base(4,11,0))
return = V1
{-# INLINE return #-}
#endif
V1 a
a >>= :: forall a b. V1 a -> (a -> V1 b) -> V1 b
>>= a -> V1 b
f = a -> V1 b
f a
a
{-# INLINE (>>=) #-}
instance Num a => Num (V1 a) where
+ :: V1 a -> V1 a -> V1 a
(+) = (a -> a -> a) -> V1 a -> V1 a -> V1 a
forall a b c. (a -> b -> c) -> V1 a -> V1 b -> V1 c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 a -> a -> a
forall a. Num a => a -> a -> a
(+)
{-# INLINE (+) #-}
(-) = (a -> a -> a) -> V1 a -> V1 a -> V1 a
forall a b c. (a -> b -> c) -> V1 a -> V1 b -> V1 c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 (-)
{-# INLINE (-) #-}
* :: V1 a -> V1 a -> V1 a
(*) = (a -> a -> a) -> V1 a -> V1 a -> V1 a
forall a b c. (a -> b -> c) -> V1 a -> V1 b -> V1 c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 a -> a -> a
forall a. Num a => a -> a -> a
(*)
{-# INLINE (*) #-}
negate :: V1 a -> V1 a
negate = (a -> a) -> V1 a -> V1 a
forall a b. (a -> b) -> V1 a -> V1 b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> a
forall a. Num a => a -> a
negate
{-# INLINE negate #-}
abs :: V1 a -> V1 a
abs = (a -> a) -> V1 a -> V1 a
forall a b. (a -> b) -> V1 a -> V1 b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> a
forall a. Num a => a -> a
abs
{-# INLINE abs #-}
signum :: V1 a -> V1 a
signum = (a -> a) -> V1 a -> V1 a
forall a b. (a -> b) -> V1 a -> V1 b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> a
forall a. Num a => a -> a
signum
{-# INLINE signum #-}
fromInteger :: Integer -> V1 a
fromInteger = a -> V1 a
forall a. a -> V1 a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (a -> V1 a) -> (Integer -> a) -> Integer -> V1 a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Integer -> a
forall a. Num a => Integer -> a
fromInteger
{-# INLINE fromInteger #-}
instance Fractional a => Fractional (V1 a) where
recip :: V1 a -> V1 a
recip = (a -> a) -> V1 a -> V1 a
forall a b. (a -> b) -> V1 a -> V1 b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> a
forall a. Fractional a => a -> a
recip
{-# INLINE recip #-}
/ :: V1 a -> V1 a -> V1 a
(/) = (a -> a -> a) -> V1 a -> V1 a -> V1 a
forall a b c. (a -> b -> c) -> V1 a -> V1 b -> V1 c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 a -> a -> a
forall a. Fractional a => a -> a -> a
(/)
{-# INLINE (/) #-}
fromRational :: Rational -> V1 a
fromRational = a -> V1 a
forall a. a -> V1 a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (a -> V1 a) -> (Rational -> a) -> Rational -> V1 a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Rational -> a
forall a. Fractional a => Rational -> a
fromRational
{-# INLINE fromRational #-}
instance Floating a => Floating (V1 a) where
pi :: V1 a
pi = a -> V1 a
forall a. a -> V1 a
forall (f :: * -> *) a. Applicative f => a -> f a
pure a
forall a. Floating a => a
pi
{-# INLINE pi #-}
exp :: V1 a -> V1 a
exp = (a -> a) -> V1 a -> V1 a
forall a b. (a -> b) -> V1 a -> V1 b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> a
forall a. Floating a => a -> a
exp
{-# INLINE exp #-}
sqrt :: V1 a -> V1 a
sqrt = (a -> a) -> V1 a -> V1 a
forall a b. (a -> b) -> V1 a -> V1 b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> a
forall a. Floating a => a -> a
sqrt
{-# INLINE sqrt #-}
log :: V1 a -> V1 a
log = (a -> a) -> V1 a -> V1 a
forall a b. (a -> b) -> V1 a -> V1 b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> a
forall a. Floating a => a -> a
log
{-# INLINE log #-}
** :: V1 a -> V1 a -> V1 a
(**) = (a -> a -> a) -> V1 a -> V1 a -> V1 a
forall a b c. (a -> b -> c) -> V1 a -> V1 b -> V1 c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 a -> a -> a
forall a. Floating a => a -> a -> a
(**)
{-# INLINE (**) #-}
logBase :: V1 a -> V1 a -> V1 a
logBase = (a -> a -> a) -> V1 a -> V1 a -> V1 a
forall a b c. (a -> b -> c) -> V1 a -> V1 b -> V1 c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 a -> a -> a
forall a. Floating a => a -> a -> a
logBase
{-# INLINE logBase #-}
sin :: V1 a -> V1 a
sin = (a -> a) -> V1 a -> V1 a
forall a b. (a -> b) -> V1 a -> V1 b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> a
forall a. Floating a => a -> a
sin
{-# INLINE sin #-}
tan :: V1 a -> V1 a
tan = (a -> a) -> V1 a -> V1 a
forall a b. (a -> b) -> V1 a -> V1 b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> a
forall a. Floating a => a -> a
tan
{-# INLINE tan #-}
cos :: V1 a -> V1 a
cos = (a -> a) -> V1 a -> V1 a
forall a b. (a -> b) -> V1 a -> V1 b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> a
forall a. Floating a => a -> a
cos
{-# INLINE cos #-}
asin :: V1 a -> V1 a
asin = (a -> a) -> V1 a -> V1 a
forall a b. (a -> b) -> V1 a -> V1 b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> a
forall a. Floating a => a -> a
asin
{-# INLINE asin #-}
atan :: V1 a -> V1 a
atan = (a -> a) -> V1 a -> V1 a
forall a b. (a -> b) -> V1 a -> V1 b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> a
forall a. Floating a => a -> a
atan
{-# INLINE atan #-}
acos :: V1 a -> V1 a
acos = (a -> a) -> V1 a -> V1 a
forall a b. (a -> b) -> V1 a -> V1 b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> a
forall a. Floating a => a -> a
acos
{-# INLINE acos #-}
sinh :: V1 a -> V1 a
sinh = (a -> a) -> V1 a -> V1 a
forall a b. (a -> b) -> V1 a -> V1 b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> a
forall a. Floating a => a -> a
sinh
{-# INLINE sinh #-}
tanh :: V1 a -> V1 a
tanh = (a -> a) -> V1 a -> V1 a
forall a b. (a -> b) -> V1 a -> V1 b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> a
forall a. Floating a => a -> a
tanh
{-# INLINE tanh #-}
cosh :: V1 a -> V1 a
cosh = (a -> a) -> V1 a -> V1 a
forall a b. (a -> b) -> V1 a -> V1 b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> a
forall a. Floating a => a -> a
cosh
{-# INLINE cosh #-}
asinh :: V1 a -> V1 a
asinh = (a -> a) -> V1 a -> V1 a
forall a b. (a -> b) -> V1 a -> V1 b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> a
forall a. Floating a => a -> a
asinh
{-# INLINE asinh #-}
atanh :: V1 a -> V1 a
atanh = (a -> a) -> V1 a -> V1 a
forall a b. (a -> b) -> V1 a -> V1 b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> a
forall a. Floating a => a -> a
atanh
{-# INLINE atanh #-}
acosh :: V1 a -> V1 a
acosh = (a -> a) -> V1 a -> V1 a
forall a b. (a -> b) -> V1 a -> V1 b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> a
forall a. Floating a => a -> a
acosh
{-# INLINE acosh #-}
instance Hashable a => Hashable (V1 a) where
hash :: V1 a -> Int
hash (V1 a
a) = a -> Int
forall a. Hashable a => a -> Int
hash a
a
hashWithSalt :: Int -> V1 a -> Int
hashWithSalt Int
s (V1 a
a) = Int
s Int -> a -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` a
a
instance Hashable1 V1 where
liftHashWithSalt :: forall a. (Int -> a -> Int) -> Int -> V1 a -> Int
liftHashWithSalt Int -> a -> Int
h Int
s (V1 a
a) = Int -> a -> Int
h Int
s a
a
{-# INLINE liftHashWithSalt #-}
instance Metric V1 where
dot :: forall a. Num a => V1 a -> V1 a -> a
dot (V1 a
a) (V1 a
b) = a
a a -> a -> a
forall a. Num a => a -> a -> a
* a
b
{-# INLINE dot #-}
class R1 t where
_x :: Lens' (t a) a
ex :: R1 t => E t
ex :: forall (t :: * -> *). R1 t => E t
ex = (forall x. Lens' (t x) x) -> E t
forall (t :: * -> *). (forall x. Lens' (t x) x) -> E t
E (x -> f x) -> t x -> f (t x)
forall x. Lens' (t x) x
forall (t :: * -> *) a. R1 t => Lens' (t a) a
_x
instance R1 V1 where
_x :: forall a. Lens' (V1 a) a
_x a -> f a
f (V1 a
a) = a -> V1 a
forall a. a -> V1 a
V1 (a -> V1 a) -> f a -> f (V1 a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f a
f a
a
{-# INLINE _x #-}
instance R1 Identity where
_x :: forall a. Lens' (Identity a) a
_x a -> f a
f (Identity a
a) = a -> Identity a
forall a. a -> Identity a
Identity (a -> Identity a) -> f a -> f (Identity a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f a
f a
a
{-# INLINE _x #-}
instance Distributive V1 where
distribute :: forall (f :: * -> *) a. Functor f => f (V1 a) -> V1 (f a)
distribute f (V1 a)
f = f a -> V1 (f a)
forall a. a -> V1 a
V1 ((V1 a -> a) -> f (V1 a) -> f a
forall a b. (a -> b) -> f a -> f b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\(V1 a
x) -> a
x) f (V1 a)
f)
{-# INLINE distribute #-}
instance Ix a => Ix (V1 a) where
{-# SPECIALISE instance Ix (V1 Int) #-}
range :: (V1 a, V1 a) -> [V1 a]
range (V1 a
l1, V1 a
u1) =
[ a -> V1 a
forall a. a -> V1 a
V1 a
i1 | a
i1 <- (a, a) -> [a]
forall a. Ix a => (a, a) -> [a]
range (a
l1,a
u1) ]
{-# INLINE range #-}
unsafeIndex :: (V1 a, V1 a) -> V1 a -> Int
unsafeIndex (V1 a
l1,V1 a
u1) (V1 a
i1) = (a, a) -> a -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a
l1,a
u1) a
i1
{-# INLINE unsafeIndex #-}
inRange :: (V1 a, V1 a) -> V1 a -> Bool
inRange (V1 a
l1,V1 a
u1) (V1 a
i1) = (a, a) -> a -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a
l1,a
u1) a
i1
{-# INLINE inRange #-}
instance Representable V1 where
type Rep V1 = E V1
tabulate :: forall a. (Rep V1 -> a) -> V1 a
tabulate Rep V1 -> a
f = a -> V1 a
forall a. a -> V1 a
V1 (Rep V1 -> a
f Rep V1
E V1
forall (t :: * -> *). R1 t => E t
ex)
{-# INLINE tabulate #-}
index :: forall a. V1 a -> Rep V1 -> a
index V1 a
xs (E forall a. Lens' (V1 a) a
l) = Getting a (V1 a) a -> V1 a -> a
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting a (V1 a) a
forall a. Lens' (V1 a) a
l V1 a
xs
{-# INLINE index #-}
instance WithIndex.FunctorWithIndex (E V1) V1 where
imap :: forall a b. (E V1 -> a -> b) -> V1 a -> V1 b
imap E V1 -> a -> b
f (V1 a
a) = b -> V1 b
forall a. a -> V1 a
V1 (E V1 -> a -> b
f E V1
forall (t :: * -> *). R1 t => E t
ex a
a)
{-# INLINE imap #-}
instance WithIndex.FoldableWithIndex (E V1) V1 where
ifoldMap :: forall m a. Monoid m => (E V1 -> a -> m) -> V1 a -> m
ifoldMap E V1 -> a -> m
f (V1 a
a) = E V1 -> a -> m
f E V1
forall (t :: * -> *). R1 t => E t
ex a
a
{-# INLINE ifoldMap #-}
instance WithIndex.TraversableWithIndex (E V1) V1 where
itraverse :: forall (f :: * -> *) a b.
Applicative f =>
(E V1 -> a -> f b) -> V1 a -> f (V1 b)
itraverse E V1 -> a -> f b
f (V1 a
a) = b -> V1 b
forall a. a -> V1 a
V1 (b -> V1 b) -> f b -> f (V1 b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> E V1 -> a -> f b
f E V1
forall (t :: * -> *). R1 t => E t
ex a
a
{-# INLINE itraverse #-}
#if !MIN_VERSION_lens(5,0,0)
instance Lens.FunctorWithIndex (E V1) V1 where imap = WithIndex.imap
instance Lens.FoldableWithIndex (E V1) V1 where ifoldMap = WithIndex.ifoldMap
instance Lens.TraversableWithIndex (E V1) V1 where itraverse = WithIndex.itraverse
#endif
type instance Index (V1 a) = E V1
type instance IxValue (V1 a) = a
instance Ixed (V1 a) where
ix :: Index (V1 a) -> Traversal' (V1 a) (IxValue (V1 a))
ix Index (V1 a)
i = E V1 -> forall a. Lens' (V1 a) a
forall (t :: * -> *). E t -> forall x. Lens' (t x) x
el Index (V1 a)
E V1
i
{-# INLINE ix #-}
instance Each (V1 a) (V1 b) a b where
each :: Traversal (V1 a) (V1 b) a b
each a -> f b
f (V1 a
x) = b -> V1 b
forall a. a -> V1 a
V1 (b -> V1 b) -> f b -> f (V1 b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f b
f a
x
{-# INLINE each #-}
newtype instance U.Vector (V1 a) = V_V1 (U.Vector a)
newtype instance U.MVector s (V1 a) = MV_V1 (U.MVector s a)
instance U.Unbox a => U.Unbox (V1 a)
instance U.Unbox a => M.MVector U.MVector (V1 a) where
{-# INLINE basicLength #-}
{-# INLINE basicUnsafeSlice #-}
{-# INLINE basicOverlaps #-}
{-# INLINE basicUnsafeNew #-}
{-# INLINE basicUnsafeRead #-}
{-# INLINE basicUnsafeWrite #-}
basicLength :: forall s. MVector s (V1 a) -> Int
basicLength (MV_V1 MVector s a
v) = MVector s a -> Int
forall s. MVector s a -> Int
forall (v :: * -> * -> *) a s. MVector v a => v s a -> Int
M.basicLength MVector s a
v
basicUnsafeSlice :: forall s. Int -> Int -> MVector s (V1 a) -> MVector s (V1 a)
basicUnsafeSlice Int
m Int
n (MV_V1 MVector s a
v) = MVector s a -> MVector s (V1 a)
forall s a. MVector s a -> MVector s (V1 a)
MV_V1 (Int -> Int -> MVector s a -> MVector s a
forall s. Int -> Int -> MVector s a -> MVector s a
forall (v :: * -> * -> *) a s.
MVector v a =>
Int -> Int -> v s a -> v s a
M.basicUnsafeSlice Int
m Int
n MVector s a
v)
basicOverlaps :: forall s. MVector s (V1 a) -> MVector s (V1 a) -> Bool
basicOverlaps (MV_V1 MVector s a
v) (MV_V1 MVector s a
u) = MVector s a -> MVector s a -> Bool
forall s. MVector s a -> MVector s a -> Bool
forall (v :: * -> * -> *) a s.
MVector v a =>
v s a -> v s a -> Bool
M.basicOverlaps MVector s a
v MVector s a
u
basicUnsafeNew :: forall s. Int -> ST s (MVector s (V1 a))
basicUnsafeNew Int
n = (MVector s a -> MVector s (V1 a))
-> ST s (MVector s a) -> ST s (MVector s (V1 a))
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM MVector s a -> MVector s (V1 a)
forall s a. MVector s a -> MVector s (V1 a)
MV_V1 (Int -> ST s (MVector s a)
forall s. Int -> ST s (MVector s a)
forall (v :: * -> * -> *) a s. MVector v a => Int -> ST s (v s a)
M.basicUnsafeNew Int
n)
basicUnsafeRead :: forall s. MVector s (V1 a) -> Int -> ST s (V1 a)
basicUnsafeRead (MV_V1 MVector s a
v) Int
i = (a -> V1 a) -> ST s a -> ST s (V1 a)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM a -> V1 a
forall a. a -> V1 a
V1 (MVector s a -> Int -> ST s a
forall s. MVector s a -> Int -> ST s a
forall (v :: * -> * -> *) a s.
MVector v a =>
v s a -> Int -> ST s a
M.basicUnsafeRead MVector s a
v Int
i)
basicUnsafeWrite :: forall s. MVector s (V1 a) -> Int -> V1 a -> ST s ()
basicUnsafeWrite (MV_V1 MVector s a
v) Int
i (V1 a
x) = MVector s a -> Int -> a -> ST s ()
forall s. MVector s a -> Int -> a -> ST s ()
forall (v :: * -> * -> *) a s.
MVector v a =>
v s a -> Int -> a -> ST s ()
M.basicUnsafeWrite MVector s a
v Int
i a
x
basicInitialize :: forall s. MVector s (V1 a) -> ST s ()
basicInitialize (MV_V1 MVector s a
v) = MVector s a -> ST s ()
forall s. MVector s a -> ST s ()
forall (v :: * -> * -> *) a s. MVector v a => v s a -> ST s ()
M.basicInitialize MVector s a
v
{-# INLINE basicInitialize #-}
instance U.Unbox a => G.Vector U.Vector (V1 a) where
{-# INLINE basicUnsafeFreeze #-}
{-# INLINE basicUnsafeThaw #-}
{-# INLINE basicLength #-}
{-# INLINE basicUnsafeSlice #-}
{-# INLINE basicUnsafeIndexM #-}
basicUnsafeFreeze :: forall s. Mutable Vector s (V1 a) -> ST s (Vector (V1 a))
basicUnsafeFreeze (MV_V1 MVector s a
v) = (Vector a -> Vector (V1 a))
-> ST s (Vector a) -> ST s (Vector (V1 a))
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Vector a -> Vector (V1 a)
forall a. Vector a -> Vector (V1 a)
V_V1 (Mutable Vector s a -> ST s (Vector a)
forall s. Mutable Vector s a -> ST s (Vector a)
forall (v :: * -> *) a s. Vector v a => Mutable v s a -> ST s (v a)
G.basicUnsafeFreeze Mutable Vector s a
MVector s a
v)
basicUnsafeThaw :: forall s. Vector (V1 a) -> ST s (Mutable Vector s (V1 a))
basicUnsafeThaw (V_V1 Vector a
v) = (MVector s a -> MVector s (V1 a))
-> ST s (MVector s a) -> ST s (MVector s (V1 a))
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM MVector s a -> MVector s (V1 a)
forall s a. MVector s a -> MVector s (V1 a)
MV_V1 (Vector a -> ST s (Mutable Vector s a)
forall s. Vector a -> ST s (Mutable Vector s a)
forall (v :: * -> *) a s. Vector v a => v a -> ST s (Mutable v s a)
G.basicUnsafeThaw Vector a
v)
basicLength :: Vector (V1 a) -> Int
basicLength (V_V1 Vector a
v) = Vector a -> Int
forall (v :: * -> *) a. Vector v a => v a -> Int
G.basicLength Vector a
v
basicUnsafeSlice :: Int -> Int -> Vector (V1 a) -> Vector (V1 a)
basicUnsafeSlice Int
m Int
n (V_V1 Vector a
v) = Vector a -> Vector (V1 a)
forall a. Vector a -> Vector (V1 a)
V_V1 (Int -> Int -> Vector a -> Vector a
forall (v :: * -> *) a. Vector v a => Int -> Int -> v a -> v a
G.basicUnsafeSlice Int
m Int
n Vector a
v)
basicUnsafeIndexM :: Vector (V1 a) -> Int -> Box (V1 a)
basicUnsafeIndexM (V_V1 Vector a
v) Int
i = (a -> V1 a) -> Box a -> Box (V1 a)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM a -> V1 a
forall a. a -> V1 a
V1 (Vector a -> Int -> Box a
forall (v :: * -> *) a. Vector v a => v a -> Int -> Box a
G.basicUnsafeIndexM Vector a
v Int
i)
instance MonadZip V1 where
mzip :: forall a b. V1 a -> V1 b -> V1 (a, b)
mzip (V1 a
a) (V1 b
b) = (a, b) -> V1 (a, b)
forall a. a -> V1 a
V1 (a
a, b
b)
mzipWith :: forall a b c. (a -> b -> c) -> V1 a -> V1 b -> V1 c
mzipWith a -> b -> c
f (V1 a
a) (V1 b
b) = c -> V1 c
forall a. a -> V1 a
V1 (a -> b -> c
f a
a b
b)
munzip :: forall a b. V1 (a, b) -> (V1 a, V1 b)
munzip (V1 (a
a,b
b)) = (a -> V1 a
forall a. a -> V1 a
V1 a
a, b -> V1 b
forall a. a -> V1 a
V1 b
b)
instance MonadFix V1 where
mfix :: forall a. (a -> V1 a) -> V1 a
mfix a -> V1 a
f = a -> V1 a
forall a. a -> V1 a
V1 (let V1 a
a = a -> V1 a
f a
a in a
a)
instance Bounded a => Bounded (V1 a) where
minBound :: V1 a
minBound = a -> V1 a
forall a. a -> V1 a
forall (f :: * -> *) a. Applicative f => a -> f a
pure a
forall a. Bounded a => a
minBound
{-# INLINE minBound #-}
maxBound :: V1 a
maxBound = a -> V1 a
forall a. a -> V1 a
forall (f :: * -> *) a. Applicative f => a -> f a
pure a
forall a. Bounded a => a
maxBound
{-# INLINE maxBound #-}
instance Serial1 V1 where
serializeWith :: forall (m :: * -> *) a. MonadPut m => (a -> m ()) -> V1 a -> m ()
serializeWith a -> m ()
f (V1 a
a) = a -> m ()
f a
a
deserializeWith :: forall (m :: * -> *) a. MonadGet m => m a -> m (V1 a)
deserializeWith m a
m = a -> V1 a
forall a. a -> V1 a
V1 (a -> V1 a) -> m a -> m (V1 a)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
`liftM` m a
m
instance Serial a => Serial (V1 a) where
serialize :: forall (m :: * -> *). MonadPut m => V1 a -> m ()
serialize (V1 a
a) = a -> m ()
forall a (m :: * -> *). (Serial a, MonadPut m) => a -> m ()
forall (m :: * -> *). MonadPut m => a -> m ()
serialize a
a
deserialize :: forall (m :: * -> *). MonadGet m => m (V1 a)
deserialize = a -> V1 a
forall a. a -> V1 a
V1 (a -> V1 a) -> m a -> m (V1 a)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
`liftM` m a
forall a (m :: * -> *). (Serial a, MonadGet m) => m a
forall (m :: * -> *). MonadGet m => m a
deserialize
instance Binary a => Binary (V1 a) where
put :: V1 a -> Put
put = (a -> Put) -> V1 a -> Put
forall (f :: * -> *) (m :: * -> *) a.
(Serial1 f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
forall (m :: * -> *) a. MonadPut m => (a -> m ()) -> V1 a -> m ()
serializeWith a -> Put
forall t. Binary t => t -> Put
Binary.put
get :: Get (V1 a)
get = Get a -> Get (V1 a)
forall (f :: * -> *) (m :: * -> *) a.
(Serial1 f, MonadGet m) =>
m a -> m (f a)
forall (m :: * -> *) a. MonadGet m => m a -> m (V1 a)
deserializeWith Get a
forall t. Binary t => Get t
Binary.get
instance Serialize a => Serialize (V1 a) where
put :: Putter (V1 a)
put = (a -> PutM ()) -> Putter (V1 a)
forall (f :: * -> *) (m :: * -> *) a.
(Serial1 f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
forall (m :: * -> *) a. MonadPut m => (a -> m ()) -> V1 a -> m ()
serializeWith a -> PutM ()
forall t. Serialize t => Putter t
Cereal.put
get :: Get (V1 a)
get = Get a -> Get (V1 a)
forall (f :: * -> *) (m :: * -> *) a.
(Serial1 f, MonadGet m) =>
m a -> m (f a)
forall (m :: * -> *) a. MonadGet m => m a -> m (V1 a)
deserializeWith Get a
forall t. Serialize t => Get t
Cereal.get
instance Random a => Random (V1 a) where
random :: forall g. RandomGen g => g -> (V1 a, g)
random g
g = case g -> (a, g)
forall g. RandomGen g => g -> (a, g)
forall a g. (Random a, RandomGen g) => g -> (a, g)
random g
g of (a
a, g
g') -> (a -> V1 a
forall a. a -> V1 a
V1 a
a, g
g')
randoms :: forall g. RandomGen g => g -> [V1 a]
randoms g
g = a -> V1 a
forall a. a -> V1 a
V1 (a -> V1 a) -> [a] -> [V1 a]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> g -> [a]
forall g. RandomGen g => g -> [a]
forall a g. (Random a, RandomGen g) => g -> [a]
randoms g
g
randomR :: forall g. RandomGen g => (V1 a, V1 a) -> g -> (V1 a, g)
randomR (V1 a
a, V1 a
b) g
g = case (a, a) -> g -> (a, g)
forall g. RandomGen g => (a, a) -> g -> (a, g)
forall a g. (Random a, RandomGen g) => (a, a) -> g -> (a, g)
randomR (a
a, a
b) g
g of (a
a', g
g') -> (a -> V1 a
forall a. a -> V1 a
V1 a
a', g
g')
randomRs :: forall g. RandomGen g => (V1 a, V1 a) -> g -> [V1 a]
randomRs (V1 a
a, V1 a
b) g
g = a -> V1 a
forall a. a -> V1 a
V1 (a -> V1 a) -> [a] -> [V1 a]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (a, a) -> g -> [a]
forall g. RandomGen g => (a, a) -> g -> [a]
forall a g. (Random a, RandomGen g) => (a, a) -> g -> [a]
randomRs (a
a, a
b) g
g
instance Eq1 V1 where
liftEq :: forall a b. (a -> b -> Bool) -> V1 a -> V1 b -> Bool
liftEq a -> b -> Bool
f (V1 a
a) (V1 b
b) = a -> b -> Bool
f a
a b
b
instance Ord1 V1 where
liftCompare :: forall a b. (a -> b -> Ordering) -> V1 a -> V1 b -> Ordering
liftCompare a -> b -> Ordering
f (V1 a
a) (V1 b
b) = a -> b -> Ordering
f a
a b
b
instance Show1 V1 where
liftShowsPrec :: forall a.
(Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> V1 a -> ShowS
liftShowsPrec Int -> a -> ShowS
f [a] -> ShowS
_ Int
d (V1 a
a) = Bool -> ShowS -> ShowS
showParen (Int
d Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
10) (ShowS -> ShowS) -> ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$ String -> ShowS
showString String
"V1 " ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> a -> ShowS
f Int
d a
a
instance Read1 V1 where
liftReadsPrec :: forall a. (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (V1 a)
liftReadsPrec Int -> ReadS a
f ReadS [a]
_ = (String -> ReadS (V1 a)) -> Int -> ReadS (V1 a)
forall a. (String -> ReadS a) -> Int -> ReadS a
readsData ((String -> ReadS (V1 a)) -> Int -> ReadS (V1 a))
-> (String -> ReadS (V1 a)) -> Int -> ReadS (V1 a)
forall a b. (a -> b) -> a -> b
$ (Int -> ReadS a) -> String -> (a -> V1 a) -> String -> ReadS (V1 a)
forall a t.
(Int -> ReadS a) -> String -> (a -> t) -> String -> ReadS t
readsUnaryWith Int -> ReadS a
f String
"V1" a -> V1 a
forall a. a -> V1 a
V1
instance Field1 (V1 a) (V1 b) a b where
_1 :: Lens (V1 a) (V1 b) a b
_1 a -> f b
f (V1 a
x) = b -> V1 b
forall a. a -> V1 a
V1 (b -> V1 b) -> f b -> f (V1 b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f b
f a
x
instance Semigroup a => Semigroup (V1 a) where
<> :: V1 a -> V1 a -> V1 a
(<>) = (a -> a -> a) -> V1 a -> V1 a -> V1 a
forall a b c. (a -> b -> c) -> V1 a -> V1 b -> V1 c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 a -> a -> a
forall a. Semigroup a => a -> a -> a
(<>)
instance Monoid a => Monoid (V1 a) where
mempty :: V1 a
mempty = a -> V1 a
forall a. a -> V1 a
forall (f :: * -> *) a. Applicative f => a -> f a
pure a
forall a. Monoid a => a
mempty
#if !(MIN_VERSION_base(4,11,0))
mappend = liftA2 mappend
#endif