{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE CPP #-}
{-# 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
-----------------------------------------------------------------------------
-- |
-- Copyright   :  (C) 2012-2015 Edward Kmett
-- License     :  BSD-style (see the file LICENSE)
--
-- Maintainer  :  Edward Kmett <ekmett@gmail.com>
-- Stability   :  experimental
-- Portability :  non-portable
--
-- 4-D Vectors
----------------------------------------------------------------------------
module Linear.V4
  ( V4(..)
  , vector, point, normalizePoint
  , R1(..)
  , R2(..)
  , _yx
  , R3(..)
  , _xz, _yz, _zx, _zy
  , _xzy, _yxz, _yzx, _zxy, _zyx
  , R4(..)
  , _xw, _yw, _zw, _wx, _wy, _wz
  , _xyw, _xzw, _xwy, _xwz, _yxw, _yzw, _ywx, _ywz, _zxw, _zyw, _zwx, _zwy
  , _wxy, _wxz, _wyx, _wyz, _wzx, _wzy
  , _xywz, _xzyw, _xzwy, _xwyz, _xwzy, _yxzw , _yxwz, _yzxw, _yzwx, _ywxz
  , _ywzx, _zxyw, _zxwy, _zyxw, _zywx, _zwxy, _zwyx, _wxyz, _wxzy, _wyxz
  , _wyzx, _wzxy, _wzyx
  , ex, ey, ez, ew
  ) where

import Control.Applicative
import Control.DeepSeq (NFData(rnf))
import Control.Monad (liftM)
import Control.Monad.Fix
import Control.Monad.Zip
import Control.Lens as Lens hiding ((<.>))
import Data.Binary as Binary
import Data.Bytes.Serial
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
#if !(MIN_VERSION_base(4,11,0))
import Data.Semigroup
#endif
import Data.Semigroup.Foldable
import Data.Serialize as Cereal
import qualified Data.Traversable.WithIndex as WithIndex
import qualified Data.Vector as V
import qualified Data.Vector.Generic.Mutable as M
import qualified Data.Vector.Generic as G
import qualified Data.Vector.Unboxed.Base as U
import Foreign.Ptr (castPtr)
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.Epsilon
import Linear.Metric
import Linear.V
import Linear.V2
import Linear.V3
import Linear.Vector
import System.Random (Random(..))

-- $setup
-- >>> import Control.Lens hiding (index)

-- | A 4-dimensional vector.
data V4 a = V4 !a !a !a !a deriving (V4 a -> V4 a -> Bool
(V4 a -> V4 a -> Bool) -> (V4 a -> V4 a -> Bool) -> Eq (V4 a)
forall a. Eq a => V4 a -> V4 a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: V4 a -> V4 a -> Bool
$c/= :: forall a. Eq a => V4 a -> V4 a -> Bool
== :: V4 a -> V4 a -> Bool
$c== :: forall a. Eq a => V4 a -> V4 a -> Bool
Eq,Eq (V4 a)
Eq (V4 a)
-> (V4 a -> V4 a -> Ordering)
-> (V4 a -> V4 a -> Bool)
-> (V4 a -> V4 a -> Bool)
-> (V4 a -> V4 a -> Bool)
-> (V4 a -> V4 a -> Bool)
-> (V4 a -> V4 a -> V4 a)
-> (V4 a -> V4 a -> V4 a)
-> Ord (V4 a)
V4 a -> V4 a -> Bool
V4 a -> V4 a -> Ordering
V4 a -> V4 a -> V4 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 (V4 a)
forall a. Ord a => V4 a -> V4 a -> Bool
forall a. Ord a => V4 a -> V4 a -> Ordering
forall a. Ord a => V4 a -> V4 a -> V4 a
min :: V4 a -> V4 a -> V4 a
$cmin :: forall a. Ord a => V4 a -> V4 a -> V4 a
max :: V4 a -> V4 a -> V4 a
$cmax :: forall a. Ord a => V4 a -> V4 a -> V4 a
>= :: V4 a -> V4 a -> Bool
$c>= :: forall a. Ord a => V4 a -> V4 a -> Bool
> :: V4 a -> V4 a -> Bool
$c> :: forall a. Ord a => V4 a -> V4 a -> Bool
<= :: V4 a -> V4 a -> Bool
$c<= :: forall a. Ord a => V4 a -> V4 a -> Bool
< :: V4 a -> V4 a -> Bool
$c< :: forall a. Ord a => V4 a -> V4 a -> Bool
compare :: V4 a -> V4 a -> Ordering
$ccompare :: forall a. Ord a => V4 a -> V4 a -> Ordering
$cp1Ord :: forall a. Ord a => Eq (V4 a)
Ord,Int -> V4 a -> ShowS
[V4 a] -> ShowS
V4 a -> String
(Int -> V4 a -> ShowS)
-> (V4 a -> String) -> ([V4 a] -> ShowS) -> Show (V4 a)
forall a. Show a => Int -> V4 a -> ShowS
forall a. Show a => [V4 a] -> ShowS
forall a. Show a => V4 a -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [V4 a] -> ShowS
$cshowList :: forall a. Show a => [V4 a] -> ShowS
show :: V4 a -> String
$cshow :: forall a. Show a => V4 a -> String
showsPrec :: Int -> V4 a -> ShowS
$cshowsPrec :: forall a. Show a => Int -> V4 a -> ShowS
Show,ReadPrec [V4 a]
ReadPrec (V4 a)
Int -> ReadS (V4 a)
ReadS [V4 a]
(Int -> ReadS (V4 a))
-> ReadS [V4 a]
-> ReadPrec (V4 a)
-> ReadPrec [V4 a]
-> Read (V4 a)
forall a. Read a => ReadPrec [V4 a]
forall a. Read a => ReadPrec (V4 a)
forall a. Read a => Int -> ReadS (V4 a)
forall a. Read a => ReadS [V4 a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [V4 a]
$creadListPrec :: forall a. Read a => ReadPrec [V4 a]
readPrec :: ReadPrec (V4 a)
$creadPrec :: forall a. Read a => ReadPrec (V4 a)
readList :: ReadS [V4 a]
$creadList :: forall a. Read a => ReadS [V4 a]
readsPrec :: Int -> ReadS (V4 a)
$creadsPrec :: forall a. Read a => Int -> ReadS (V4 a)
Read,Typeable (V4 a)
DataType
Constr
Typeable (V4 a)
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> V4 a -> c (V4 a))
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (V4 a))
-> (V4 a -> Constr)
-> (V4 a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (V4 a)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (V4 a)))
-> ((forall b. Data b => b -> b) -> V4 a -> V4 a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> V4 a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> V4 a -> r)
-> (forall u. (forall d. Data d => d -> u) -> V4 a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> V4 a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> V4 a -> m (V4 a))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> V4 a -> m (V4 a))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> V4 a -> m (V4 a))
-> Data (V4 a)
V4 a -> DataType
V4 a -> Constr
(forall d. Data d => c (t d)) -> Maybe (c (V4 a))
(forall b. Data b => b -> b) -> V4 a -> V4 a
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> V4 a -> c (V4 a)
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (V4 a)
forall a. Data a => Typeable (V4 a)
forall a. Data a => V4 a -> DataType
forall a. Data a => V4 a -> Constr
forall a. Data a => (forall b. Data b => b -> b) -> V4 a -> V4 a
forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> V4 a -> u
forall a u. Data a => (forall d. Data d => d -> u) -> V4 a -> [u]
forall a r r'.
Data a =>
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> V4 a -> r
forall a r r'.
Data a =>
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> V4 a -> r
forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> V4 a -> m (V4 a)
forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> V4 a -> m (V4 a)
forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (V4 a)
forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> V4 a -> c (V4 a)
forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (V4 a))
forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (V4 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) -> V4 a -> u
forall u. (forall d. Data d => d -> u) -> V4 a -> [u]
forall r r'.
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> V4 a -> r
forall r r'.
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> V4 a -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> V4 a -> m (V4 a)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> V4 a -> m (V4 a)
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (V4 a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> V4 a -> c (V4 a)
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (V4 a))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (V4 a))
$cV4 :: Constr
$tV4 :: DataType
gmapMo :: (forall d. Data d => d -> m d) -> V4 a -> m (V4 a)
$cgmapMo :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> V4 a -> m (V4 a)
gmapMp :: (forall d. Data d => d -> m d) -> V4 a -> m (V4 a)
$cgmapMp :: forall a (m :: * -> *).
(Data a, MonadPlus m) =>
(forall d. Data d => d -> m d) -> V4 a -> m (V4 a)
gmapM :: (forall d. Data d => d -> m d) -> V4 a -> m (V4 a)
$cgmapM :: forall a (m :: * -> *).
(Data a, Monad m) =>
(forall d. Data d => d -> m d) -> V4 a -> m (V4 a)
gmapQi :: Int -> (forall d. Data d => d -> u) -> V4 a -> u
$cgmapQi :: forall a u.
Data a =>
Int -> (forall d. Data d => d -> u) -> V4 a -> u
gmapQ :: (forall d. Data d => d -> u) -> V4 a -> [u]
$cgmapQ :: forall a u. Data a => (forall d. Data d => d -> u) -> V4 a -> [u]
gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> V4 a -> r
$cgmapQr :: forall a r r'.
Data a =>
(r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> V4 a -> r
gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> V4 a -> r
$cgmapQl :: forall a r r'.
Data a =>
(r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> V4 a -> r
gmapT :: (forall b. Data b => b -> b) -> V4 a -> V4 a
$cgmapT :: forall a. Data a => (forall b. Data b => b -> b) -> V4 a -> V4 a
dataCast2 :: (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (V4 a))
$cdataCast2 :: forall a (t :: * -> * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (V4 a))
dataCast1 :: (forall d. Data d => c (t d)) -> Maybe (c (V4 a))
$cdataCast1 :: forall a (t :: * -> *) (c :: * -> *).
(Data a, Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (V4 a))
dataTypeOf :: V4 a -> DataType
$cdataTypeOf :: forall a. Data a => V4 a -> DataType
toConstr :: V4 a -> Constr
$ctoConstr :: forall a. Data a => V4 a -> Constr
gunfold :: (forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (V4 a)
$cgunfold :: forall a (c :: * -> *).
Data a =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (V4 a)
gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> V4 a -> c (V4 a)
$cgfoldl :: forall a (c :: * -> *).
Data a =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> V4 a -> c (V4 a)
$cp1Data :: forall a. Data a => Typeable (V4 a)
Data
                                    ,(forall x. V4 a -> Rep (V4 a) x)
-> (forall x. Rep (V4 a) x -> V4 a) -> Generic (V4 a)
forall x. Rep (V4 a) x -> V4 a
forall x. V4 a -> Rep (V4 a) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall a x. Rep (V4 a) x -> V4 a
forall a x. V4 a -> Rep (V4 a) x
$cto :: forall a x. Rep (V4 a) x -> V4 a
$cfrom :: forall a x. V4 a -> Rep (V4 a) x
Generic,(forall a. V4 a -> Rep1 V4 a)
-> (forall a. Rep1 V4 a -> V4 a) -> Generic1 V4
forall a. Rep1 V4 a -> V4 a
forall a. V4 a -> Rep1 V4 a
forall k (f :: k -> *).
(forall (a :: k). f a -> Rep1 f a)
-> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f
$cto1 :: forall a. Rep1 V4 a -> V4 a
$cfrom1 :: forall a. V4 a -> Rep1 V4 a
Generic1
#if defined(MIN_VERSION_template_haskell)
                                    ,V4 a -> Q Exp
V4 a -> Q (TExp (V4 a))
(V4 a -> Q Exp) -> (V4 a -> Q (TExp (V4 a))) -> Lift (V4 a)
forall a. Lift a => V4 a -> Q Exp
forall a. Lift a => V4 a -> Q (TExp (V4 a))
forall t. (t -> Q Exp) -> (t -> Q (TExp t)) -> Lift t
liftTyped :: V4 a -> Q (TExp (V4 a))
$cliftTyped :: forall a. Lift a => V4 a -> Q (TExp (V4 a))
lift :: V4 a -> Q Exp
$clift :: forall a. Lift a => V4 a -> Q Exp
Lift
#endif
                                    )

instance Finite V4 where
  type Size V4 = 4
  toV :: V4 a -> V (Size V4) a
toV (V4 a
a a
b a
c a
d) = Vector a -> V 4 a
forall k (n :: k) a. Vector a -> V n a
V (Int -> [a] -> Vector a
forall a. Int -> [a] -> Vector a
V.fromListN Int
4 [a
a,a
b,a
c,a
d])
  fromV :: V (Size V4) a -> V4 a
fromV (V Vector a
v) = a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 (Vector a
v Vector a -> Int -> a
forall a. Vector a -> Int -> a
V.! Int
0) (Vector a
v Vector a -> Int -> a
forall a. Vector a -> Int -> a
V.! Int
1) (Vector a
v Vector a -> Int -> a
forall a. Vector a -> Int -> a
V.! Int
2) (Vector a
v Vector a -> Int -> a
forall a. Vector a -> Int -> a
V.! Int
3)

instance Functor V4 where
  fmap :: (a -> b) -> V4 a -> V4 b
fmap a -> b
f (V4 a
a a
b a
c a
d) = b -> b -> b -> b -> V4 b
forall a. a -> a -> a -> a -> V4 a
V4 (a -> b
f a
a) (a -> b
f a
b) (a -> b
f a
c) (a -> b
f a
d)
  {-# INLINE fmap #-}
  a
a <$ :: a -> V4 b -> V4 a
<$ V4 b
_ = a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a a
a a
a a
a
  {-# INLINE (<$) #-}

instance Foldable V4 where
  foldMap :: (a -> m) -> V4 a -> m
foldMap a -> m
f (V4 a
a a
b a
c a
d) = a -> m
f a
a m -> m -> m
forall a. Monoid a => a -> a -> a
`mappend` a -> m
f a
b m -> m -> m
forall a. Monoid a => a -> a -> a
`mappend` a -> m
f a
c m -> m -> m
forall a. Monoid a => a -> a -> a
`mappend` a -> m
f a
d
  {-# INLINE foldMap #-}
#if MIN_VERSION_base(4,13,0)
  foldMap' :: (a -> m) -> V4 a -> m
foldMap' a -> m
f (V4 a
a a
b a
c a
d) = ((a -> m
f a
a m -> m -> m
forall a. Monoid a => a -> a -> a
`mappend` a -> m
f a
b) m -> m -> m
forall a. Monoid a => a -> a -> a
`mappend` a -> m
f a
c) m -> m -> m
forall a. Monoid a => a -> a -> a
`mappend` a -> m
f a
d
  {-# INLINE foldMap' #-}
#endif
  null :: V4 a -> Bool
null V4 a
_ = Bool
False
  length :: V4 a -> Int
length V4 a
_ = Int
4

instance Random a => Random (V4 a) where
  random :: g -> (V4 a, g)
random g
g = case g -> (a, g)
forall a g. (Random a, RandomGen g) => g -> (a, g)
random g
g of
    (a
a, g
g') -> case g -> (a, g)
forall a g. (Random a, RandomGen g) => g -> (a, g)
random g
g' of
      (a
b, g
g'') -> case g -> (a, g)
forall a g. (Random a, RandomGen g) => g -> (a, g)
random g
g'' of
        (a
c, g
g''') -> case g -> (a, g)
forall a g. (Random a, RandomGen g) => g -> (a, g)
random g
g''' of
          (a
d, g
g'''') -> (a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a a
b a
c a
d, g
g'''')
  randomR :: (V4 a, V4 a) -> g -> (V4 a, g)
randomR (V4 a
a a
b a
c a
d, V4 a
a' a
b' a
c' a
d') g
g = case (a, a) -> g -> (a, g)
forall a g. (Random a, RandomGen g) => (a, a) -> g -> (a, g)
randomR (a
a,a
a') g
g of
    (a
a'', g
g') -> case (a, a) -> g -> (a, g)
forall a g. (Random a, RandomGen g) => (a, a) -> g -> (a, g)
randomR (a
b,a
b') g
g' of
      (a
b'', g
g'') -> case (a, a) -> g -> (a, g)
forall a g. (Random a, RandomGen g) => (a, a) -> g -> (a, g)
randomR (a
c,a
c') g
g'' of
        (a
c'', g
g''') -> case (a, a) -> g -> (a, g)
forall a g. (Random a, RandomGen g) => (a, a) -> g -> (a, g)
randomR (a
d,a
d') g
g''' of
          (a
d'', g
g'''') -> (a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a'' a
b'' a
c'' a
d'', g
g'''')

instance Traversable V4 where
  traverse :: (a -> f b) -> V4 a -> f (V4 b)
traverse a -> f b
f (V4 a
a a
b a
c a
d) = b -> b -> b -> b -> V4 b
forall a. a -> a -> a -> a -> V4 a
V4 (b -> b -> b -> b -> V4 b) -> f b -> f (b -> b -> b -> V4 b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f b
f a
a f (b -> b -> b -> V4 b) -> f b -> f (b -> b -> V4 b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
b f (b -> b -> V4 b) -> f b -> f (b -> V4 b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
c f (b -> V4 b) -> f b -> f (V4 b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
d
  {-# INLINE traverse #-}

instance Foldable1 V4 where
  foldMap1 :: (a -> m) -> V4 a -> m
foldMap1 a -> m
f (V4 a
a a
b a
c a
d) = a -> m
f a
a m -> m -> m
forall a. Semigroup a => a -> a -> a
<> a -> m
f a
b m -> m -> m
forall a. Semigroup a => a -> a -> a
<> a -> m
f a
c m -> m -> m
forall a. Semigroup a => a -> a -> a
<> a -> m
f a
d
  {-# INLINE foldMap1 #-}

instance Traversable1 V4 where
  traverse1 :: (a -> f b) -> V4 a -> f (V4 b)
traverse1 a -> f b
f (V4 a
a a
b a
c a
d) = b -> b -> b -> b -> V4 b
forall a. a -> a -> a -> a -> V4 a
V4 (b -> b -> b -> b -> V4 b) -> f b -> f (b -> b -> b -> V4 b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f b
f a
a f (b -> b -> b -> V4 b) -> f b -> f (b -> b -> V4 b)
forall (f :: * -> *) a b. Apply f => f (a -> b) -> f a -> f b
<.> a -> f b
f a
b f (b -> b -> V4 b) -> f b -> f (b -> V4 b)
forall (f :: * -> *) a b. Apply f => f (a -> b) -> f a -> f b
<.> a -> f b
f a
c f (b -> V4 b) -> f b -> f (V4 b)
forall (f :: * -> *) a b. Apply f => f (a -> b) -> f a -> f b
<.> a -> f b
f a
d
  {-# INLINE traverse1 #-}

instance Applicative V4 where
  pure :: a -> V4 a
pure a
a = a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a a
a a
a a
a
  {-# INLINE pure #-}
  V4 a -> b
a a -> b
b a -> b
c a -> b
d <*> :: V4 (a -> b) -> V4 a -> V4 b
<*> V4 a
e a
f a
g a
h = b -> b -> b -> b -> V4 b
forall a. a -> a -> a -> a -> V4 a
V4 (a -> b
a a
e) (a -> b
b a
f) (a -> b
c a
g) (a -> b
d a
h)
  {-# INLINE (<*>) #-}

instance Apply V4 where
  V4 a -> b
a a -> b
b a -> b
c a -> b
d <.> :: V4 (a -> b) -> V4 a -> V4 b
<.> V4 a
e a
f a
g a
h = b -> b -> b -> b -> V4 b
forall a. a -> a -> a -> a -> V4 a
V4 (a -> b
a a
e) (a -> b
b a
f) (a -> b
c a
g) (a -> b
d a
h)
  {-# INLINE (<.>) #-}

instance Additive V4 where
  zero :: V4 a
zero = a -> V4 a
forall (f :: * -> *) a. Applicative f => a -> f a
pure a
0
  {-# INLINE zero #-}
  liftU2 :: (a -> a -> a) -> V4 a -> V4 a -> V4 a
liftU2 = (a -> a -> a) -> V4 a -> V4 a -> V4 a
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2
  {-# INLINE liftU2 #-}
  liftI2 :: (a -> b -> c) -> V4 a -> V4 b -> V4 c
liftI2 = (a -> b -> c) -> V4 a -> V4 b -> V4 c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2
  {-# INLINE liftI2 #-}

instance Bind V4 where
  V4 a
a a
b a
c a
d >>- :: V4 a -> (a -> V4 b) -> V4 b
>>- a -> V4 b
f = b -> b -> b -> b -> V4 b
forall a. a -> a -> a -> a -> V4 a
V4 b
a' b
b' b
c' b
d' where
    V4 b
a' b
_ b
_ b
_ = a -> V4 b
f a
a
    V4 b
_ b
b' b
_ b
_ = a -> V4 b
f a
b
    V4 b
_ b
_ b
c' b
_ = a -> V4 b
f a
c
    V4 b
_ b
_ b
_ b
d' = a -> V4 b
f a
d
  {-# INLINE (>>-) #-}

instance Monad V4 where
#if !(MIN_VERSION_base(4,11,0))
  return a = V4 a a a a
  {-# INLINE return #-}
#endif
  V4 a
a a
b a
c a
d >>= :: V4 a -> (a -> V4 b) -> V4 b
>>= a -> V4 b
f = b -> b -> b -> b -> V4 b
forall a. a -> a -> a -> a -> V4 a
V4 b
a' b
b' b
c' b
d' where
    V4 b
a' b
_ b
_ b
_ = a -> V4 b
f a
a
    V4 b
_ b
b' b
_ b
_ = a -> V4 b
f a
b
    V4 b
_ b
_ b
c' b
_ = a -> V4 b
f a
c
    V4 b
_ b
_ b
_ b
d' = a -> V4 b
f a
d
  {-# INLINE (>>=) #-}

instance Num a => Num (V4 a) where
  + :: V4 a -> V4 a -> V4 a
(+) = (a -> a -> a) -> V4 a -> V4 a -> V4 a
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 (+) #-}
  * :: V4 a -> V4 a -> V4 a
(*) = (a -> a -> a) -> V4 a -> V4 a -> V4 a
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) -> V4 a -> V4 a -> V4 a
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 (-)
  {-# INLINE (*) #-}
  negate :: V4 a -> V4 a
negate = (a -> a) -> V4 a -> V4 a
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 :: V4 a -> V4 a
abs = (a -> a) -> V4 a -> V4 a
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 :: V4 a -> V4 a
signum = (a -> a) -> V4 a -> V4 a
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 -> V4 a
fromInteger = a -> V4 a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (a -> V4 a) -> (Integer -> a) -> Integer -> V4 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 (V4 a) where
  recip :: V4 a -> V4 a
recip = (a -> a) -> V4 a -> V4 a
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> a
forall a. Fractional a => a -> a
recip
  {-# INLINE recip #-}
  / :: V4 a -> V4 a -> V4 a
(/) = (a -> a -> a) -> V4 a -> V4 a -> V4 a
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 -> V4 a
fromRational = a -> V4 a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (a -> V4 a) -> (Rational -> a) -> Rational -> V4 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 (V4 a) where
    pi :: V4 a
pi = a -> V4 a
forall (f :: * -> *) a. Applicative f => a -> f a
pure a
forall a. Floating a => a
pi
    {-# INLINE pi #-}
    exp :: V4 a -> V4 a
exp = (a -> a) -> V4 a -> V4 a
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 :: V4 a -> V4 a
sqrt = (a -> a) -> V4 a -> V4 a
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 :: V4 a -> V4 a
log = (a -> a) -> V4 a -> V4 a
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap a -> a
forall a. Floating a => a -> a
log
    {-# INLINE log #-}
    ** :: V4 a -> V4 a -> V4 a
(**) = (a -> a -> a) -> V4 a -> V4 a -> V4 a
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 :: V4 a -> V4 a -> V4 a
logBase = (a -> a -> a) -> V4 a -> V4 a -> V4 a
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 :: V4 a -> V4 a
sin = (a -> a) -> V4 a -> V4 a
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 :: V4 a -> V4 a
tan = (a -> a) -> V4 a -> V4 a
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 :: V4 a -> V4 a
cos = (a -> a) -> V4 a -> V4 a
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 :: V4 a -> V4 a
asin = (a -> a) -> V4 a -> V4 a
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 :: V4 a -> V4 a
atan = (a -> a) -> V4 a -> V4 a
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 :: V4 a -> V4 a
acos = (a -> a) -> V4 a -> V4 a
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 :: V4 a -> V4 a
sinh = (a -> a) -> V4 a -> V4 a
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 :: V4 a -> V4 a
tanh = (a -> a) -> V4 a -> V4 a
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 :: V4 a -> V4 a
cosh = (a -> a) -> V4 a -> V4 a
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 :: V4 a -> V4 a
asinh = (a -> a) -> V4 a -> V4 a
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 :: V4 a -> V4 a
atanh = (a -> a) -> V4 a -> V4 a
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 :: V4 a -> V4 a
acosh = (a -> a) -> V4 a -> V4 a
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 Metric V4 where
  dot :: V4 a -> V4 a -> a
dot (V4 a
a a
b a
c a
d) (V4 a
e a
f a
g a
h) = a
a a -> a -> a
forall a. Num a => a -> a -> a
* a
e a -> a -> a
forall a. Num a => a -> a -> a
+ a
b a -> a -> a
forall a. Num a => a -> a -> a
* a
f a -> a -> a
forall a. Num a => a -> a -> a
+ a
c a -> a -> a
forall a. Num a => a -> a -> a
* a
g a -> a -> a
forall a. Num a => a -> a -> a
+ a
d a -> a -> a
forall a. Num a => a -> a -> a
* a
h
  {-# INLINE dot #-}

instance Distributive V4 where
  distribute :: f (V4 a) -> V4 (f a)
distribute f (V4 a)
f = f a -> f a -> f a -> f a -> V4 (f a)
forall a. a -> a -> a -> a -> V4 a
V4 ((V4 a -> a) -> f (V4 a) -> f a
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\(V4 a
x a
_ a
_ a
_) -> a
x) f (V4 a)
f)
                    ((V4 a -> a) -> f (V4 a) -> f a
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\(V4 a
_ a
y a
_ a
_) -> a
y) f (V4 a)
f)
                    ((V4 a -> a) -> f (V4 a) -> f a
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\(V4 a
_ a
_ a
z a
_) -> a
z) f (V4 a)
f)
                    ((V4 a -> a) -> f (V4 a) -> f a
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (\(V4 a
_ a
_ a
_ a
w) -> a
w) f (V4 a)
f)
  {-# INLINE distribute #-}

instance Hashable a => Hashable (V4 a) where
  hashWithSalt :: Int -> V4 a -> Int
hashWithSalt Int
s (V4 a
a a
b a
c a
d) = Int
s Int -> a -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` a
a Int -> a -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` a
b Int -> a -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` a
c Int -> a -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` a
d
  {-# INLINE hashWithSalt #-}

instance Hashable1 V4 where
  liftHashWithSalt :: (Int -> a -> Int) -> Int -> V4 a -> Int
liftHashWithSalt Int -> a -> Int
h Int
s (V4 a
a a
b a
c a
d) = Int
s Int -> a -> Int
`h` a
a Int -> a -> Int
`h` a
b Int -> a -> Int
`h` a
c Int -> a -> Int
`h` a
d
  {-# INLINE liftHashWithSalt #-}

-- | A space that distinguishes orthogonal basis vectors '_x', '_y', '_z', '_w'. (It may have more.)
class R3 t => R4 t where
  -- |
  -- >>> V4 1 2 3 4 ^._w
  -- 4
  _w :: Lens' (t a) a
  _xyzw :: Lens' (t a) (V4 a)

_xw, _yw, _zw, _wx, _wy, _wz :: R4 t => Lens' (t a) (V2 a)
_xw :: Lens' (t a) (V2 a)
_xw V2 a -> f (V2 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V2 a -> f (V2 a)
f (a -> a -> V2 a
forall a. a -> a -> V2 a
V2 a
a a
d) f (V2 a) -> (V2 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V2 a
a' a
d') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b a
c a
d'
{-# INLINE _xw #-}

_yw :: Lens' (t a) (V2 a)
_yw V2 a -> f (V2 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V2 a -> f (V2 a)
f (a -> a -> V2 a
forall a. a -> a -> V2 a
V2 a
b a
d) f (V2 a) -> (V2 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V2 a
b' a
d') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a a
b' a
c a
d'
{-# INLINE _yw #-}

_zw :: Lens' (t a) (V2 a)
_zw V2 a -> f (V2 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V2 a -> f (V2 a)
f (a -> a -> V2 a
forall a. a -> a -> V2 a
V2 a
c a
d) f (V2 a) -> (V2 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V2 a
c' a
d') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a a
b a
c' a
d'
{-# INLINE _zw #-}

_wx :: Lens' (t a) (V2 a)
_wx V2 a -> f (V2 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V2 a -> f (V2 a)
f (a -> a -> V2 a
forall a. a -> a -> V2 a
V2 a
d a
a) f (V2 a) -> (V2 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V2 a
d' a
a') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b a
c a
d'
{-# INLINE _wx #-}

_wy :: Lens' (t a) (V2 a)
_wy V2 a -> f (V2 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V2 a -> f (V2 a)
f (a -> a -> V2 a
forall a. a -> a -> V2 a
V2 a
d a
b) f (V2 a) -> (V2 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V2 a
d' a
b') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a a
b' a
c a
d'
{-# INLINE _wy #-}

_wz :: Lens' (t a) (V2 a)
_wz V2 a -> f (V2 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V2 a -> f (V2 a)
f (a -> a -> V2 a
forall a. a -> a -> V2 a
V2 a
d a
c) f (V2 a) -> (V2 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V2 a
d' a
c') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a a
b a
c' a
d'
{-# INLINE _wz #-}

_xyw, _xzw, _xwy, _xwz, _yxw, _yzw, _ywx, _ywz, _zxw, _zyw, _zwx, _zwy, _wxy, _wxz, _wyx, _wyz, _wzx, _wzy :: R4 t => Lens' (t a) (V3 a)
_xyw :: Lens' (t a) (V3 a)
_xyw V3 a -> f (V3 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V3 a -> f (V3 a)
f (a -> a -> a -> V3 a
forall a. a -> a -> a -> V3 a
V3 a
a a
b a
d) f (V3 a) -> (V3 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V3 a
a' a
b' a
d') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b' a
c a
d'
{-# INLINE _xyw #-}

_xzw :: Lens' (t a) (V3 a)
_xzw V3 a -> f (V3 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V3 a -> f (V3 a)
f (a -> a -> a -> V3 a
forall a. a -> a -> a -> V3 a
V3 a
a a
c a
d) f (V3 a) -> (V3 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V3 a
a' a
c' a
d') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b a
c' a
d'
{-# INLINE _xzw #-}

_xwy :: Lens' (t a) (V3 a)
_xwy V3 a -> f (V3 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V3 a -> f (V3 a)
f (a -> a -> a -> V3 a
forall a. a -> a -> a -> V3 a
V3 a
a a
d a
b) f (V3 a) -> (V3 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V3 a
a' a
d' a
b') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b' a
c a
d'
{-# INLINE _xwy #-}

_xwz :: Lens' (t a) (V3 a)
_xwz V3 a -> f (V3 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V3 a -> f (V3 a)
f (a -> a -> a -> V3 a
forall a. a -> a -> a -> V3 a
V3 a
a a
d a
c) f (V3 a) -> (V3 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V3 a
a' a
d' a
c') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b a
c' a
d'
{-# INLINE _xwz #-}

_yxw :: Lens' (t a) (V3 a)
_yxw V3 a -> f (V3 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V3 a -> f (V3 a)
f (a -> a -> a -> V3 a
forall a. a -> a -> a -> V3 a
V3 a
b a
a a
d) f (V3 a) -> (V3 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V3 a
b' a
a' a
d') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b' a
c a
d'
{-# INLINE _yxw #-}

_yzw :: Lens' (t a) (V3 a)
_yzw V3 a -> f (V3 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V3 a -> f (V3 a)
f (a -> a -> a -> V3 a
forall a. a -> a -> a -> V3 a
V3 a
b a
c a
d) f (V3 a) -> (V3 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V3 a
b' a
c' a
d') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a a
b' a
c' a
d'
{-# INLINE _yzw #-}

_ywx :: Lens' (t a) (V3 a)
_ywx V3 a -> f (V3 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V3 a -> f (V3 a)
f (a -> a -> a -> V3 a
forall a. a -> a -> a -> V3 a
V3 a
b a
d a
a) f (V3 a) -> (V3 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V3 a
b' a
d' a
a') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b' a
c a
d'
{-# INLINE _ywx #-}

_ywz :: Lens' (t a) (V3 a)
_ywz V3 a -> f (V3 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V3 a -> f (V3 a)
f (a -> a -> a -> V3 a
forall a. a -> a -> a -> V3 a
V3 a
b a
d a
c) f (V3 a) -> (V3 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V3 a
b' a
d' a
c') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a a
b' a
c' a
d'
{-# INLINE _ywz #-}

_zxw :: Lens' (t a) (V3 a)
_zxw V3 a -> f (V3 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V3 a -> f (V3 a)
f (a -> a -> a -> V3 a
forall a. a -> a -> a -> V3 a
V3 a
c a
a a
d) f (V3 a) -> (V3 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V3 a
c' a
a' a
d') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b a
c' a
d'
{-# INLINE _zxw #-}

_zyw :: Lens' (t a) (V3 a)
_zyw V3 a -> f (V3 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V3 a -> f (V3 a)
f (a -> a -> a -> V3 a
forall a. a -> a -> a -> V3 a
V3 a
c a
b a
d) f (V3 a) -> (V3 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V3 a
c' a
b' a
d') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a a
b' a
c' a
d'
{-# INLINE _zyw #-}

_zwx :: Lens' (t a) (V3 a)
_zwx V3 a -> f (V3 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V3 a -> f (V3 a)
f (a -> a -> a -> V3 a
forall a. a -> a -> a -> V3 a
V3 a
c a
d a
a) f (V3 a) -> (V3 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V3 a
c' a
d' a
a') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b a
c' a
d'
{-# INLINE _zwx #-}

_zwy :: Lens' (t a) (V3 a)
_zwy V3 a -> f (V3 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V3 a -> f (V3 a)
f (a -> a -> a -> V3 a
forall a. a -> a -> a -> V3 a
V3 a
c a
d a
b) f (V3 a) -> (V3 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V3 a
c' a
d' a
b') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a a
b' a
c' a
d'
{-# INLINE _zwy #-}

_wxy :: Lens' (t a) (V3 a)
_wxy V3 a -> f (V3 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V3 a -> f (V3 a)
f (a -> a -> a -> V3 a
forall a. a -> a -> a -> V3 a
V3 a
d a
a a
b) f (V3 a) -> (V3 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V3 a
d' a
a' a
b') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b' a
c a
d'
{-# INLINE _wxy #-}

_wxz :: Lens' (t a) (V3 a)
_wxz V3 a -> f (V3 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V3 a -> f (V3 a)
f (a -> a -> a -> V3 a
forall a. a -> a -> a -> V3 a
V3 a
d a
a a
c) f (V3 a) -> (V3 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V3 a
d' a
a' a
c') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b a
c' a
d'
{-# INLINE _wxz #-}

_wyx :: Lens' (t a) (V3 a)
_wyx V3 a -> f (V3 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V3 a -> f (V3 a)
f (a -> a -> a -> V3 a
forall a. a -> a -> a -> V3 a
V3 a
d a
b a
a) f (V3 a) -> (V3 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V3 a
d' a
b' a
a') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b' a
c a
d'
{-# INLINE _wyx #-}

_wyz :: Lens' (t a) (V3 a)
_wyz V3 a -> f (V3 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V3 a -> f (V3 a)
f (a -> a -> a -> V3 a
forall a. a -> a -> a -> V3 a
V3 a
d a
b a
c) f (V3 a) -> (V3 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V3 a
d' a
b' a
c') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a a
b' a
c' a
d'
{-# INLINE _wyz #-}

_wzx :: Lens' (t a) (V3 a)
_wzx V3 a -> f (V3 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V3 a -> f (V3 a)
f (a -> a -> a -> V3 a
forall a. a -> a -> a -> V3 a
V3 a
d a
c a
a) f (V3 a) -> (V3 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V3 a
d' a
c' a
a') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b a
c' a
d'
{-# INLINE _wzx #-}

_wzy :: Lens' (t a) (V3 a)
_wzy V3 a -> f (V3 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V3 a -> f (V3 a)
f (a -> a -> a -> V3 a
forall a. a -> a -> a -> V3 a
V3 a
d a
c a
b) f (V3 a) -> (V3 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V3 a
d' a
c' a
b') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a a
b' a
c' a
d'
{-# INLINE _wzy #-}

_xywz, _xzyw, _xzwy, _xwyz, _xwzy, _yxzw , _yxwz, _yzxw, _yzwx, _ywxz
  , _ywzx, _zxyw, _zxwy, _zyxw, _zywx, _zwxy, _zwyx, _wxyz, _wxzy, _wyxz
  , _wyzx, _wzxy, _wzyx :: R4 t => Lens' (t a) (V4 a)
_xywz :: Lens' (t a) (V4 a)
_xywz V4 a -> f (V4 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V4 a -> f (V4 a)
f (a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a a
b a
d a
c) f (V4 a) -> (V4 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V4 a
a' a
b' a
d' a
c') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b' a
c' a
d'
{-# INLINE _xywz #-}

_xzyw :: Lens' (t a) (V4 a)
_xzyw V4 a -> f (V4 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V4 a -> f (V4 a)
f (a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a a
c a
b a
d) f (V4 a) -> (V4 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V4 a
a' a
c' a
b' a
d') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b' a
c' a
d'
{-# INLINE _xzyw #-}

_xzwy :: Lens' (t a) (V4 a)
_xzwy V4 a -> f (V4 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V4 a -> f (V4 a)
f (a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a a
c a
d a
b) f (V4 a) -> (V4 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V4 a
a' a
c' a
d' a
b') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b' a
c' a
d'
{-# INLINE _xzwy #-}

_xwyz :: Lens' (t a) (V4 a)
_xwyz V4 a -> f (V4 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V4 a -> f (V4 a)
f (a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a a
d a
b a
c) f (V4 a) -> (V4 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V4 a
a' a
d' a
b' a
c') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b' a
c' a
d'
{-# INLINE _xwyz #-}

_xwzy :: Lens' (t a) (V4 a)
_xwzy V4 a -> f (V4 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V4 a -> f (V4 a)
f (a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a a
d a
c a
b) f (V4 a) -> (V4 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V4 a
a' a
d' a
c' a
b') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b' a
c' a
d'
{-# INLINE _xwzy #-}

_yxzw :: Lens' (t a) (V4 a)
_yxzw V4 a -> f (V4 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V4 a -> f (V4 a)
f (a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
b a
a a
c a
d) f (V4 a) -> (V4 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V4 a
b' a
a' a
c' a
d') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b' a
c' a
d'
{-# INLINE _yxzw #-}

_yxwz :: Lens' (t a) (V4 a)
_yxwz V4 a -> f (V4 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V4 a -> f (V4 a)
f (a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
b a
a a
d a
c) f (V4 a) -> (V4 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V4 a
b' a
a' a
d' a
c') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b' a
c' a
d'
{-# INLINE _yxwz #-}

_yzxw :: Lens' (t a) (V4 a)
_yzxw V4 a -> f (V4 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V4 a -> f (V4 a)
f (a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
b a
c a
a a
d) f (V4 a) -> (V4 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V4 a
b' a
c' a
a' a
d') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b' a
c' a
d'
{-# INLINE _yzxw #-}

_yzwx :: Lens' (t a) (V4 a)
_yzwx V4 a -> f (V4 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V4 a -> f (V4 a)
f (a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
b a
c a
d a
a) f (V4 a) -> (V4 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V4 a
b' a
c' a
d' a
a') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b' a
c' a
d'
{-# INLINE _yzwx #-}

_ywxz :: Lens' (t a) (V4 a)
_ywxz V4 a -> f (V4 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V4 a -> f (V4 a)
f (a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
b a
d a
a a
c) f (V4 a) -> (V4 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V4 a
b' a
d' a
a' a
c') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b' a
c' a
d'
{-# INLINE _ywxz #-}

_ywzx :: Lens' (t a) (V4 a)
_ywzx V4 a -> f (V4 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V4 a -> f (V4 a)
f (a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
b a
d a
c a
a) f (V4 a) -> (V4 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V4 a
b' a
d' a
c' a
a') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b' a
c' a
d'
{-# INLINE _ywzx #-}

_zxyw :: Lens' (t a) (V4 a)
_zxyw V4 a -> f (V4 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V4 a -> f (V4 a)
f (a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
c a
a a
b a
d) f (V4 a) -> (V4 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V4 a
c' a
a' a
b' a
d') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b' a
c' a
d'
{-# INLINE _zxyw #-}

_zxwy :: Lens' (t a) (V4 a)
_zxwy V4 a -> f (V4 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V4 a -> f (V4 a)
f (a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
c a
a a
d a
b) f (V4 a) -> (V4 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V4 a
c' a
a' a
d' a
b') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b' a
c' a
d'
{-# INLINE _zxwy #-}

_zyxw :: Lens' (t a) (V4 a)
_zyxw V4 a -> f (V4 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V4 a -> f (V4 a)
f (a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
c a
b a
a a
d) f (V4 a) -> (V4 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V4 a
c' a
b' a
a' a
d') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b' a
c' a
d'
{-# INLINE _zyxw #-}

_zywx :: Lens' (t a) (V4 a)
_zywx V4 a -> f (V4 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V4 a -> f (V4 a)
f (a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
c a
b a
d a
a) f (V4 a) -> (V4 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V4 a
c' a
b' a
d' a
a') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b' a
c' a
d'
{-# INLINE _zywx #-}

_zwxy :: Lens' (t a) (V4 a)
_zwxy V4 a -> f (V4 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V4 a -> f (V4 a)
f (a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
c a
d a
a a
b) f (V4 a) -> (V4 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V4 a
c' a
d' a
a' a
b') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b' a
c' a
d'
{-# INLINE _zwxy #-}

_zwyx :: Lens' (t a) (V4 a)
_zwyx V4 a -> f (V4 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V4 a -> f (V4 a)
f (a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
c a
d a
b a
a) f (V4 a) -> (V4 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V4 a
c' a
d' a
b' a
a') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b' a
c' a
d'
{-# INLINE _zwyx #-}

_wxyz :: Lens' (t a) (V4 a)
_wxyz V4 a -> f (V4 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V4 a -> f (V4 a)
f (a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
d a
a a
b a
c) f (V4 a) -> (V4 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V4 a
d' a
a' a
b' a
c') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b' a
c' a
d'
{-# INLINE _wxyz #-}

_wxzy :: Lens' (t a) (V4 a)
_wxzy V4 a -> f (V4 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V4 a -> f (V4 a)
f (a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
d a
a a
c a
b) f (V4 a) -> (V4 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V4 a
d' a
a' a
c' a
b') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b' a
c' a
d'
{-# INLINE _wxzy #-}

_wyxz :: Lens' (t a) (V4 a)
_wyxz V4 a -> f (V4 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V4 a -> f (V4 a)
f (a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
d a
b a
a a
c) f (V4 a) -> (V4 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V4 a
d' a
b' a
a' a
c') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b' a
c' a
d'
{-# INLINE _wyxz #-}

_wyzx :: Lens' (t a) (V4 a)
_wyzx V4 a -> f (V4 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V4 a -> f (V4 a)
f (a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
d a
b a
c a
a) f (V4 a) -> (V4 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V4 a
d' a
b' a
c' a
a') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b' a
c' a
d'
{-# INLINE _wyzx #-}

_wzxy :: Lens' (t a) (V4 a)
_wzxy V4 a -> f (V4 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V4 a -> f (V4 a)
f (a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
d a
c a
a a
b) f (V4 a) -> (V4 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V4 a
d' a
c' a
a' a
b') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b' a
c' a
d'
{-# INLINE _wzxy #-}

_wzyx :: Lens' (t a) (V4 a)
_wzyx V4 a -> f (V4 a)
f = (V4 a -> f (V4 a)) -> t a -> f (t a)
forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw ((V4 a -> f (V4 a)) -> t a -> f (t a))
-> (V4 a -> f (V4 a)) -> t a -> f (t a)
forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V4 a -> f (V4 a)
f (a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
d a
c a
b a
a) f (V4 a) -> (V4 a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V4 a
d' a
c' a
b' a
a') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b' a
c' a
d'
{-# INLINE _wzyx #-}

ew :: R4 t => E t
ew :: E t
ew = (forall x. Lens' (t x) x) -> E t
forall (t :: * -> *). (forall x. Lens' (t x) x) -> E t
E forall x. Lens' (t x) x
forall (t :: * -> *) a. R4 t => Lens' (t a) a
_w

instance R1 V4 where
  _x :: (a -> f a) -> V4 a -> f (V4 a)
_x a -> f a
f (V4 a
a a
b a
c a
d) = (\a
a' -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b a
c a
d) (a -> V4 a) -> f a -> f (V4 a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f a
f a
a
  {-# INLINE _x #-}

instance R2 V4 where
  _y :: (a -> f a) -> V4 a -> f (V4 a)
_y a -> f a
f (V4 a
a a
b a
c a
d) = (\a
b' -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a a
b' a
c a
d) (a -> V4 a) -> f a -> f (V4 a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f a
f a
b
  {-# INLINE _y #-}
  _xy :: (V2 a -> f (V2 a)) -> V4 a -> f (V4 a)
_xy V2 a -> f (V2 a)
f (V4 a
a a
b a
c a
d) = (\(V2 a
a' a
b') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b' a
c a
d) (V2 a -> V4 a) -> f (V2 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> V2 a -> f (V2 a)
f (a -> a -> V2 a
forall a. a -> a -> V2 a
V2 a
a a
b)
  {-# INLINE _xy #-}

instance R3 V4 where
  _z :: (a -> f a) -> V4 a -> f (V4 a)
_z a -> f a
f (V4 a
a a
b a
c a
d) = (\a
c' -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a a
b a
c' a
d) (a -> V4 a) -> f a -> f (V4 a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f a
f a
c
  {-# INLINE _z #-}
  _xyz :: (V3 a -> f (V3 a)) -> V4 a -> f (V4 a)
_xyz V3 a -> f (V3 a)
f (V4 a
a a
b a
c a
d) = (\(V3 a
a' a
b' a
c') -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b' a
c' a
d) (V3 a -> V4 a) -> f (V3 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> V3 a -> f (V3 a)
f (a -> a -> a -> V3 a
forall a. a -> a -> a -> V3 a
V3 a
a a
b a
c)
  {-# INLINE _xyz #-}

instance R4 V4 where
  _w :: (a -> f a) -> V4 a -> f (V4 a)
_w a -> f a
f (V4 a
a a
b a
c a
d) = a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a a
b a
c (a -> V4 a) -> f a -> f (V4 a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f a
f a
d
  {-# INLINE _w #-}
  _xyzw :: (V4 a -> f (V4 a)) -> V4 a -> f (V4 a)
_xyzw = (V4 a -> f (V4 a)) -> V4 a -> f (V4 a)
forall a. a -> a
id
  {-# INLINE _xyzw #-}

instance Storable a => Storable (V4 a) where
  sizeOf :: V4 a -> Int
sizeOf V4 a
_ = Int
4 Int -> Int -> Int
forall a. Num a => a -> a -> a
* a -> Int
forall a. Storable a => a -> Int
sizeOf (a
forall a. HasCallStack => a
undefined::a)
  {-# INLINE sizeOf #-}
  alignment :: V4 a -> Int
alignment V4 a
_ = a -> Int
forall a. Storable a => a -> Int
alignment (a
forall a. HasCallStack => a
undefined::a)
  {-# INLINE alignment #-}
  poke :: Ptr (V4 a) -> V4 a -> IO ()
poke Ptr (V4 a)
ptr (V4 a
x a
y a
z a
w) = do Ptr a -> a -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr a
ptr' a
x
                             Ptr a -> Int -> a -> IO ()
forall a. Storable a => Ptr a -> Int -> a -> IO ()
pokeElemOff Ptr a
ptr' Int
1 a
y
                             Ptr a -> Int -> a -> IO ()
forall a. Storable a => Ptr a -> Int -> a -> IO ()
pokeElemOff Ptr a
ptr' Int
2 a
z
                             Ptr a -> Int -> a -> IO ()
forall a. Storable a => Ptr a -> Int -> a -> IO ()
pokeElemOff Ptr a
ptr' Int
3 a
w
    where ptr' :: Ptr a
ptr' = Ptr (V4 a) -> Ptr a
forall a b. Ptr a -> Ptr b
castPtr Ptr (V4 a)
ptr
  {-# INLINE poke #-}
  peek :: Ptr (V4 a) -> IO (V4 a)
peek Ptr (V4 a)
ptr = a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 (a -> a -> a -> a -> V4 a) -> IO a -> IO (a -> a -> a -> V4 a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Ptr a -> IO a
forall a. Storable a => Ptr a -> IO a
peek Ptr a
ptr' IO (a -> a -> a -> V4 a) -> IO a -> IO (a -> a -> V4 a)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Ptr a -> Int -> IO a
forall a. Storable a => Ptr a -> Int -> IO a
peekElemOff Ptr a
ptr' Int
1
                IO (a -> a -> V4 a) -> IO a -> IO (a -> V4 a)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Ptr a -> Int -> IO a
forall a. Storable a => Ptr a -> Int -> IO a
peekElemOff Ptr a
ptr' Int
2 IO (a -> V4 a) -> IO a -> IO (V4 a)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Ptr a -> Int -> IO a
forall a. Storable a => Ptr a -> Int -> IO a
peekElemOff Ptr a
ptr' Int
3
    where ptr' :: Ptr a
ptr' = Ptr (V4 a) -> Ptr a
forall a b. Ptr a -> Ptr b
castPtr Ptr (V4 a)
ptr
  {-# INLINE peek #-}

-- | Convert a 3-dimensional affine vector into a 4-dimensional homogeneous vector,
-- i.e. sets the @w@ coordinate to 0.
vector :: Num a => V3 a -> V4 a
vector :: V3 a -> V4 a
vector (V3 a
a a
b a
c) = a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a a
b a
c a
0
{-# INLINE vector #-}

-- | Convert a 3-dimensional affine point into a 4-dimensional homogeneous vector,
-- i.e. sets the @w@ coordinate to 1.
point :: Num a => V3 a -> V4 a
point :: V3 a -> V4 a
point (V3 a
a a
b a
c) = a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a a
b a
c a
1
{-# INLINE point #-}

-- | Convert 4-dimensional projective coordinates to a 3-dimensional
-- point. This operation may be denoted, @euclidean [x:y:z:w] = (x\/w,
-- y\/w, z\/w)@ where the projective, homogenous, coordinate
-- @[x:y:z:w]@ is one of many associated with a single point @(x\/w,
-- y\/w, z\/w)@.
normalizePoint :: Fractional a => V4 a -> V3 a
normalizePoint :: V4 a -> V3 a
normalizePoint (V4 a
a a
b a
c a
w) = (a
1a -> a -> a
forall a. Fractional a => a -> a -> a
/a
w) a -> V3 a -> V3 a
forall (f :: * -> *) a. (Functor f, Num a) => a -> f a -> f a
*^ a -> a -> a -> V3 a
forall a. a -> a -> a -> V3 a
V3 a
a a
b a
c
{-# INLINE normalizePoint #-}

instance Epsilon a => Epsilon (V4 a) where
  nearZero :: V4 a -> Bool
nearZero = a -> Bool
forall a. Epsilon a => a -> Bool
nearZero (a -> Bool) -> (V4 a -> a) -> V4 a -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. V4 a -> a
forall (f :: * -> *) a. (Metric f, Num a) => f a -> a
quadrance
  {-# INLINE nearZero #-}

instance Ix a => Ix (V4 a) where
  {-# SPECIALISE instance Ix (V4 Int) #-}

  range :: (V4 a, V4 a) -> [V4 a]
range (V4 a
l1 a
l2 a
l3 a
l4,V4 a
u1 a
u2 a
u3 a
u4) =
    [a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
i1 a
i2 a
i3 a
i4 | a
i1 <- (a, a) -> [a]
forall a. Ix a => (a, a) -> [a]
range (a
l1,a
u1)
                    , a
i2 <- (a, a) -> [a]
forall a. Ix a => (a, a) -> [a]
range (a
l2,a
u2)
                    , a
i3 <- (a, a) -> [a]
forall a. Ix a => (a, a) -> [a]
range (a
l3,a
u3)
                    , a
i4 <- (a, a) -> [a]
forall a. Ix a => (a, a) -> [a]
range (a
l4,a
u4)
                    ]
  {-# INLINE range #-}

  unsafeIndex :: (V4 a, V4 a) -> V4 a -> Int
unsafeIndex (V4 a
l1 a
l2 a
l3 a
l4,V4 a
u1 a
u2 a
u3 a
u4) (V4 a
i1 a
i2 a
i3 a
i4) =
    (a, a) -> a -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a
l4,a
u4) a
i4 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a, a) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a
l4,a
u4) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
    (a, a) -> a -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a
l3,a
u3) a
i3 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a, a) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a
l3,a
u3) Int -> Int -> Int
forall a. Num a => a -> a -> a
* (
    (a, a) -> a -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a
l2,a
u2) a
i2 Int -> Int -> Int
forall a. Num a => a -> a -> a
+ (a, a) -> Int
forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a
l2,a
u2) Int -> Int -> Int
forall a. Num a => a -> a -> a
*
    (a, a) -> a -> Int
forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a
l1,a
u1) a
i1))
  {-# INLINE unsafeIndex #-}

  inRange :: (V4 a, V4 a) -> V4 a -> Bool
inRange (V4 a
l1 a
l2 a
l3 a
l4,V4 a
u1 a
u2 a
u3 a
u4) (V4 a
i1 a
i2 a
i3 a
i4) =
    (a, a) -> a -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a
l1,a
u1) a
i1 Bool -> Bool -> Bool
&& (a, a) -> a -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a
l2,a
u2) a
i2 Bool -> Bool -> Bool
&&
    (a, a) -> a -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a
l3,a
u3) a
i3 Bool -> Bool -> Bool
&& (a, a) -> a -> Bool
forall a. Ix a => (a, a) -> a -> Bool
inRange (a
l4,a
u4) a
i4
  {-# INLINE inRange #-}

instance Representable V4 where
  type Rep V4 = E V4
  tabulate :: (Rep V4 -> a) -> V4 a
tabulate Rep V4 -> a
f = a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 (Rep V4 -> a
f Rep V4
forall (t :: * -> *). R1 t => E t
ex) (Rep V4 -> a
f Rep V4
forall (t :: * -> *). R2 t => E t
ey) (Rep V4 -> a
f Rep V4
forall (t :: * -> *). R3 t => E t
ez) (Rep V4 -> a
f Rep V4
forall (t :: * -> *). R4 t => E t
ew)
  {-# INLINE tabulate #-}
  index :: V4 a -> Rep V4 -> a
index V4 a
xs (E l) = Getting a (V4 a) a -> V4 a -> a
forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view Getting a (V4 a) a
forall a. Lens' (V4 a) a
l V4 a
xs
  {-# INLINE index #-}

instance WithIndex.FunctorWithIndex (E V4) V4 where
  imap :: (E V4 -> a -> b) -> V4 a -> V4 b
imap E V4 -> a -> b
f (V4 a
a a
b a
c a
d) = b -> b -> b -> b -> V4 b
forall a. a -> a -> a -> a -> V4 a
V4 (E V4 -> a -> b
f E V4
forall (t :: * -> *). R1 t => E t
ex a
a) (E V4 -> a -> b
f E V4
forall (t :: * -> *). R2 t => E t
ey a
b) (E V4 -> a -> b
f E V4
forall (t :: * -> *). R3 t => E t
ez a
c) (E V4 -> a -> b
f E V4
forall (t :: * -> *). R4 t => E t
ew a
d)
  {-# INLINE imap #-}

instance WithIndex.FoldableWithIndex (E V4) V4 where
  ifoldMap :: (E V4 -> a -> m) -> V4 a -> m
ifoldMap E V4 -> a -> m
f (V4 a
a a
b a
c a
d) = E V4 -> a -> m
f E V4
forall (t :: * -> *). R1 t => E t
ex a
a m -> m -> m
forall a. Monoid a => a -> a -> a
`mappend` E V4 -> a -> m
f E V4
forall (t :: * -> *). R2 t => E t
ey a
b m -> m -> m
forall a. Monoid a => a -> a -> a
`mappend` E V4 -> a -> m
f E V4
forall (t :: * -> *). R3 t => E t
ez a
c m -> m -> m
forall a. Monoid a => a -> a -> a
`mappend` E V4 -> a -> m
f E V4
forall (t :: * -> *). R4 t => E t
ew a
d
  {-# INLINE ifoldMap #-}

instance WithIndex.TraversableWithIndex (E V4) V4 where
  itraverse :: (E V4 -> a -> f b) -> V4 a -> f (V4 b)
itraverse E V4 -> a -> f b
f (V4 a
a a
b a
c a
d) = b -> b -> b -> b -> V4 b
forall a. a -> a -> a -> a -> V4 a
V4 (b -> b -> b -> b -> V4 b) -> f b -> f (b -> b -> b -> V4 b)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> E V4 -> a -> f b
f E V4
forall (t :: * -> *). R1 t => E t
ex a
a f (b -> b -> b -> V4 b) -> f b -> f (b -> b -> V4 b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> E V4 -> a -> f b
f E V4
forall (t :: * -> *). R2 t => E t
ey a
b f (b -> b -> V4 b) -> f b -> f (b -> V4 b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> E V4 -> a -> f b
f E V4
forall (t :: * -> *). R3 t => E t
ez a
c f (b -> V4 b) -> f b -> f (V4 b)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> E V4 -> a -> f b
f E V4
forall (t :: * -> *). R4 t => E t
ew a
d
  {-# INLINE itraverse #-}

#if !MIN_VERSION_lens(5,0,0)
instance Lens.FunctorWithIndex     (E V4) V4 where imap      = WithIndex.imap
instance Lens.FoldableWithIndex    (E V4) V4 where ifoldMap  = WithIndex.ifoldMap
instance Lens.TraversableWithIndex (E V4) V4 where itraverse = WithIndex.itraverse
#endif

type instance Index (V4 a) = E V4
type instance IxValue (V4 a) = a

instance Ixed (V4 a) where
  ix :: Index (V4 a) -> Traversal' (V4 a) (IxValue (V4 a))
ix Index (V4 a)
i = E V4 -> forall a. Lens' (V4 a) a
forall (t :: * -> *). E t -> forall x. Lens' (t x) x
el Index (V4 a)
E V4
i

instance Each (V4 a) (V4 b) a b where
  each :: (a -> f b) -> V4 a -> f (V4 b)
each = (a -> f b) -> V4 a -> f (V4 b)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse

data instance U.Vector    (V4 a) =  V_V4 {-# UNPACK #-} !Int !(U.Vector    a)
data instance U.MVector s (V4 a) = MV_V4 {-# UNPACK #-} !Int !(U.MVector s a)
instance U.Unbox a => U.Unbox (V4 a)

instance U.Unbox a => M.MVector U.MVector (V4 a) where
  basicLength :: MVector s (V4 a) -> Int
basicLength (MV_V4 n _) = Int
n
  basicUnsafeSlice :: Int -> Int -> MVector s (V4 a) -> MVector s (V4 a)
basicUnsafeSlice Int
m Int
n (MV_V4 _ v) = Int -> MVector s a -> MVector s (V4 a)
forall s a. Int -> MVector s a -> MVector s (V4 a)
MV_V4 Int
n (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
4Int -> Int -> Int
forall a. Num a => a -> a -> a
*Int
m) (Int
4Int -> Int -> Int
forall a. Num a => a -> a -> a
*Int
n) MVector s a
v)
  basicOverlaps :: MVector s (V4 a) -> MVector s (V4 a) -> Bool
basicOverlaps (MV_V4 _ v) (MV_V4 _ u) = 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 :: Int -> m (MVector (PrimState m) (V4 a))
basicUnsafeNew Int
n = (MVector (PrimState m) a -> MVector (PrimState m) (V4 a))
-> m (MVector (PrimState m) a) -> m (MVector (PrimState m) (V4 a))
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (Int -> MVector (PrimState m) a -> MVector (PrimState m) (V4 a)
forall s a. Int -> MVector s a -> MVector s (V4 a)
MV_V4 Int
n) (Int -> m (MVector (PrimState m) a)
forall (v :: * -> * -> *) a (m :: * -> *).
(MVector v a, PrimMonad m) =>
Int -> m (v (PrimState m) a)
M.basicUnsafeNew (Int
4Int -> Int -> Int
forall a. Num a => a -> a -> a
*Int
n))
  basicUnsafeRead :: MVector (PrimState m) (V4 a) -> Int -> m (V4 a)
basicUnsafeRead (MV_V4 _ v) Int
i =
    do let o :: Int
o = Int
4Int -> Int -> Int
forall a. Num a => a -> a -> a
*Int
i
       a
x <- MVector (PrimState m) a -> Int -> m a
forall (v :: * -> * -> *) a (m :: * -> *).
(MVector v a, PrimMonad m) =>
v (PrimState m) a -> Int -> m a
M.basicUnsafeRead MVector (PrimState m) a
v Int
o
       a
y <- MVector (PrimState m) a -> Int -> m a
forall (v :: * -> * -> *) a (m :: * -> *).
(MVector v a, PrimMonad m) =>
v (PrimState m) a -> Int -> m a
M.basicUnsafeRead MVector (PrimState m) a
v (Int
oInt -> Int -> Int
forall a. Num a => a -> a -> a
+Int
1)
       a
z <- MVector (PrimState m) a -> Int -> m a
forall (v :: * -> * -> *) a (m :: * -> *).
(MVector v a, PrimMonad m) =>
v (PrimState m) a -> Int -> m a
M.basicUnsafeRead MVector (PrimState m) a
v (Int
oInt -> Int -> Int
forall a. Num a => a -> a -> a
+Int
2)
       a
w <- MVector (PrimState m) a -> Int -> m a
forall (v :: * -> * -> *) a (m :: * -> *).
(MVector v a, PrimMonad m) =>
v (PrimState m) a -> Int -> m a
M.basicUnsafeRead MVector (PrimState m) a
v (Int
oInt -> Int -> Int
forall a. Num a => a -> a -> a
+Int
3)
       V4 a -> m (V4 a)
forall (m :: * -> *) a. Monad m => a -> m a
return (a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
x a
y a
z a
w)
  basicUnsafeWrite :: MVector (PrimState m) (V4 a) -> Int -> V4 a -> m ()
basicUnsafeWrite (MV_V4 _ v) Int
i (V4 a
x a
y a
z a
w) =
    do let o :: Int
o = Int
4Int -> Int -> Int
forall a. Num a => a -> a -> a
*Int
i
       MVector (PrimState m) a -> Int -> a -> m ()
forall (v :: * -> * -> *) a (m :: * -> *).
(MVector v a, PrimMonad m) =>
v (PrimState m) a -> Int -> a -> m ()
M.basicUnsafeWrite MVector (PrimState m) a
v Int
o     a
x
       MVector (PrimState m) a -> Int -> a -> m ()
forall (v :: * -> * -> *) a (m :: * -> *).
(MVector v a, PrimMonad m) =>
v (PrimState m) a -> Int -> a -> m ()
M.basicUnsafeWrite MVector (PrimState m) a
v (Int
oInt -> Int -> Int
forall a. Num a => a -> a -> a
+Int
1) a
y
       MVector (PrimState m) a -> Int -> a -> m ()
forall (v :: * -> * -> *) a (m :: * -> *).
(MVector v a, PrimMonad m) =>
v (PrimState m) a -> Int -> a -> m ()
M.basicUnsafeWrite MVector (PrimState m) a
v (Int
oInt -> Int -> Int
forall a. Num a => a -> a -> a
+Int
2) a
z
       MVector (PrimState m) a -> Int -> a -> m ()
forall (v :: * -> * -> *) a (m :: * -> *).
(MVector v a, PrimMonad m) =>
v (PrimState m) a -> Int -> a -> m ()
M.basicUnsafeWrite MVector (PrimState m) a
v (Int
oInt -> Int -> Int
forall a. Num a => a -> a -> a
+Int
3) a
w
  basicInitialize :: MVector (PrimState m) (V4 a) -> m ()
basicInitialize (MV_V4 _ v) = MVector (PrimState m) a -> m ()
forall (v :: * -> * -> *) a (m :: * -> *).
(MVector v a, PrimMonad m) =>
v (PrimState m) a -> m ()
M.basicInitialize MVector (PrimState m) a
v

instance U.Unbox a => G.Vector U.Vector (V4 a) where
  basicUnsafeFreeze :: Mutable Vector (PrimState m) (V4 a) -> m (Vector (V4 a))
basicUnsafeFreeze (MV_V4 n v) = (Vector a -> Vector (V4 a)) -> m (Vector a) -> m (Vector (V4 a))
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM ( Int -> Vector a -> Vector (V4 a)
forall a. Int -> Vector a -> Vector (V4 a)
V_V4 Int
n) (Mutable Vector (PrimState m) a -> m (Vector a)
forall (v :: * -> *) a (m :: * -> *).
(Vector v a, PrimMonad m) =>
Mutable v (PrimState m) a -> m (v a)
G.basicUnsafeFreeze MVector (PrimState m) a
Mutable Vector (PrimState m) a
v)
  basicUnsafeThaw :: Vector (V4 a) -> m (Mutable Vector (PrimState m) (V4 a))
basicUnsafeThaw   ( V_V4 n v) = (MVector (PrimState m) a -> MVector (PrimState m) (V4 a))
-> m (MVector (PrimState m) a) -> m (MVector (PrimState m) (V4 a))
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (Int -> MVector (PrimState m) a -> MVector (PrimState m) (V4 a)
forall s a. Int -> MVector s a -> MVector s (V4 a)
MV_V4 Int
n) (Vector a -> m (Mutable Vector (PrimState m) a)
forall (v :: * -> *) a (m :: * -> *).
(Vector v a, PrimMonad m) =>
v a -> m (Mutable v (PrimState m) a)
G.basicUnsafeThaw   Vector a
v)
  basicLength :: Vector (V4 a) -> Int
basicLength       ( V_V4 n _) = Int
n
  basicUnsafeSlice :: Int -> Int -> Vector (V4 a) -> Vector (V4 a)
basicUnsafeSlice Int
m Int
n (V_V4 _ v) = Int -> Vector a -> Vector (V4 a)
forall a. Int -> Vector a -> Vector (V4 a)
V_V4 Int
n (Int -> Int -> Vector a -> Vector a
forall (v :: * -> *) a. Vector v a => Int -> Int -> v a -> v a
G.basicUnsafeSlice (Int
4Int -> Int -> Int
forall a. Num a => a -> a -> a
*Int
m) (Int
4Int -> Int -> Int
forall a. Num a => a -> a -> a
*Int
n) Vector a
v)
  basicUnsafeIndexM :: Vector (V4 a) -> Int -> m (V4 a)
basicUnsafeIndexM (V_V4 _ v) Int
i =
    do let o :: Int
o = Int
4Int -> Int -> Int
forall a. Num a => a -> a -> a
*Int
i
       a
x <- Vector a -> Int -> m a
forall (v :: * -> *) a (m :: * -> *).
(Vector v a, Monad m) =>
v a -> Int -> m a
G.basicUnsafeIndexM Vector a
v Int
o
       a
y <- Vector a -> Int -> m a
forall (v :: * -> *) a (m :: * -> *).
(Vector v a, Monad m) =>
v a -> Int -> m a
G.basicUnsafeIndexM Vector a
v (Int
oInt -> Int -> Int
forall a. Num a => a -> a -> a
+Int
1)
       a
z <- Vector a -> Int -> m a
forall (v :: * -> *) a (m :: * -> *).
(Vector v a, Monad m) =>
v a -> Int -> m a
G.basicUnsafeIndexM Vector a
v (Int
oInt -> Int -> Int
forall a. Num a => a -> a -> a
+Int
2)
       a
w <- Vector a -> Int -> m a
forall (v :: * -> *) a (m :: * -> *).
(Vector v a, Monad m) =>
v a -> Int -> m a
G.basicUnsafeIndexM Vector a
v (Int
oInt -> Int -> Int
forall a. Num a => a -> a -> a
+Int
3)
       V4 a -> m (V4 a)
forall (m :: * -> *) a. Monad m => a -> m a
return (a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
x a
y a
z a
w)

instance MonadZip V4 where
  mzipWith :: (a -> b -> c) -> V4 a -> V4 b -> V4 c
mzipWith = (a -> b -> c) -> V4 a -> V4 b -> V4 c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2

instance MonadFix V4 where
  mfix :: (a -> V4 a) -> V4 a
mfix a -> V4 a
f = a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 (let V4 a
a a
_ a
_ a
_ = a -> V4 a
f a
a in a
a)
              (let V4 a
_ a
a a
_ a
_ = a -> V4 a
f a
a in a
a)
              (let V4 a
_ a
_ a
a a
_ = a -> V4 a
f a
a in a
a)
              (let V4 a
_ a
_ a
_ a
a = a -> V4 a
f a
a in a
a)

instance Bounded a => Bounded (V4 a) where
  minBound :: V4 a
minBound = a -> V4 a
forall (f :: * -> *) a. Applicative f => a -> f a
pure a
forall a. Bounded a => a
minBound
  {-# INLINE minBound #-}
  maxBound :: V4 a
maxBound = a -> V4 a
forall (f :: * -> *) a. Applicative f => a -> f a
pure a
forall a. Bounded a => a
maxBound
  {-# INLINE maxBound #-}

instance NFData a => NFData (V4 a) where
  rnf :: V4 a -> ()
rnf (V4 a
a a
b a
c a
d) = a -> ()
forall a. NFData a => a -> ()
rnf a
a () -> () -> ()
`seq` a -> ()
forall a. NFData a => a -> ()
rnf a
b () -> () -> ()
`seq` a -> ()
forall a. NFData a => a -> ()
rnf a
c () -> () -> ()
`seq` a -> ()
forall a. NFData a => a -> ()
rnf a
d

instance Serial1 V4 where
  serializeWith :: (a -> m ()) -> V4 a -> m ()
serializeWith = (a -> m ()) -> V4 a -> m ()
forall (t :: * -> *) (f :: * -> *) a b.
(Foldable t, Applicative f) =>
(a -> f b) -> t a -> f ()
traverse_
  deserializeWith :: m a -> m (V4 a)
deserializeWith m a
k = a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 (a -> a -> a -> a -> V4 a) -> m a -> m (a -> a -> a -> V4 a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> m a
k m (a -> a -> a -> V4 a) -> m a -> m (a -> a -> V4 a)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m a
k m (a -> a -> V4 a) -> m a -> m (a -> V4 a)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m a
k m (a -> V4 a) -> m a -> m (V4 a)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> m a
k

instance Serial a => Serial (V4 a) where
  serialize :: V4 a -> m ()
serialize = (a -> m ()) -> V4 a -> m ()
forall (f :: * -> *) (m :: * -> *) a.
(Serial1 f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
serializeWith a -> m ()
forall a (m :: * -> *). (Serial a, MonadPut m) => a -> m ()
serialize
  deserialize :: m (V4 a)
deserialize = m a -> m (V4 a)
forall (f :: * -> *) (m :: * -> *) a.
(Serial1 f, MonadGet m) =>
m a -> m (f a)
deserializeWith m a
forall a (m :: * -> *). (Serial a, MonadGet m) => m a
deserialize

instance Binary a => Binary (V4 a) where
  put :: V4 a -> Put
put = (a -> Put) -> V4 a -> Put
forall (f :: * -> *) (m :: * -> *) a.
(Serial1 f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
serializeWith a -> Put
forall t. Binary t => t -> Put
Binary.put
  get :: Get (V4 a)
get = Get a -> Get (V4 a)
forall (f :: * -> *) (m :: * -> *) a.
(Serial1 f, MonadGet m) =>
m a -> m (f a)
deserializeWith Get a
forall t. Binary t => Get t
Binary.get

instance Serialize a => Serialize (V4 a) where
  put :: Putter (V4 a)
put = (a -> PutM ()) -> Putter (V4 a)
forall (f :: * -> *) (m :: * -> *) a.
(Serial1 f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
serializeWith a -> PutM ()
forall t. Serialize t => Putter t
Cereal.put
  get :: Get (V4 a)
get = Get a -> Get (V4 a)
forall (f :: * -> *) (m :: * -> *) a.
(Serial1 f, MonadGet m) =>
m a -> m (f a)
deserializeWith Get a
forall t. Serialize t => Get t
Cereal.get

instance Eq1 V4 where
  liftEq :: (a -> b -> Bool) -> V4 a -> V4 b -> Bool
liftEq a -> b -> Bool
k (V4 a
a a
b a
c a
d) (V4 b
e b
f b
g b
h) = a -> b -> Bool
k a
a b
e Bool -> Bool -> Bool
&& a -> b -> Bool
k a
b b
f Bool -> Bool -> Bool
&& a -> b -> Bool
k a
c b
g Bool -> Bool -> Bool
&& a -> b -> Bool
k a
d b
h
instance Ord1 V4 where
  liftCompare :: (a -> b -> Ordering) -> V4 a -> V4 b -> Ordering
liftCompare a -> b -> Ordering
k (V4 a
a a
b a
c a
d) (V4 b
e b
f b
g b
h) = a -> b -> Ordering
k a
a b
e Ordering -> Ordering -> Ordering
forall a. Monoid a => a -> a -> a
`mappend` a -> b -> Ordering
k a
b b
f Ordering -> Ordering -> Ordering
forall a. Monoid a => a -> a -> a
`mappend` a -> b -> Ordering
k a
c b
g Ordering -> Ordering -> Ordering
forall a. Monoid a => a -> a -> a
`mappend` a -> b -> Ordering
k a
d b
h
instance Read1 V4 where
  liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (V4 a)
liftReadsPrec Int -> ReadS a
k ReadS [a]
_ Int
z = Bool -> ReadS (V4 a) -> ReadS (V4 a)
forall a. Bool -> ReadS a -> ReadS a
readParen (Int
z Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
> Int
10) (ReadS (V4 a) -> ReadS (V4 a)) -> ReadS (V4 a) -> ReadS (V4 a)
forall a b. (a -> b) -> a -> b
$ \String
r ->
     [ (a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
a a
b a
c a
d, String
r5)
     | (String
"V4",String
r1) <- ReadS String
lex String
r
     , (a
a,String
r2) <- Int -> ReadS a
k Int
11 String
r1
     , (a
b,String
r3) <- Int -> ReadS a
k Int
11 String
r2
     , (a
c,String
r4) <- Int -> ReadS a
k Int
11 String
r3
     , (a
d,String
r5) <- Int -> ReadS a
k Int
11 String
r4
     ]
instance Show1 V4 where
  liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> V4 a -> ShowS
liftShowsPrec Int -> a -> ShowS
f [a] -> ShowS
_ Int
z (V4 a
a a
b a
c a
d) = Bool -> ShowS -> ShowS
showParen (Int
z 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
"V4 " ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> a -> ShowS
f Int
11 a
a ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> ShowS
showChar Char
' ' ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> a -> ShowS
f Int
11 a
b ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> ShowS
showChar Char
' ' ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> a -> ShowS
f Int
11 a
c ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> ShowS
showChar Char
' ' ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> a -> ShowS
f Int
11 a
d

instance Field1 (V4 a) (V4 a) a a where
  _1 :: (a -> f a) -> V4 a -> f (V4 a)
_1 a -> f a
f (V4 a
x a
y a
z a
w) = a -> f a
f a
x f a -> (a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \a
x' -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
x' a
y a
z a
w

instance Field2 (V4 a) (V4 a) a a where
  _2 :: (a -> f a) -> V4 a -> f (V4 a)
_2 a -> f a
f (V4 a
x a
y a
z a
w) = a -> f a
f a
y f a -> (a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \a
y' -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
x a
y' a
z a
w

instance Field3 (V4 a) (V4 a) a a where
  _3 :: (a -> f a) -> V4 a -> f (V4 a)
_3 a -> f a
f (V4 a
x a
y a
z a
w) = a -> f a
f a
z f a -> (a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \a
z' -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
x a
y a
z' a
w

instance Field4 (V4 a) (V4 a) a a where
  _4 :: (a -> f a) -> V4 a -> f (V4 a)
_4 a -> f a
f (V4 a
x a
y a
z a
w) = a -> f a
f a
w f a -> (a -> V4 a) -> f (V4 a)
forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \a
w' -> a -> a -> a -> a -> V4 a
forall a. a -> a -> a -> a -> V4 a
V4 a
x a
y a
z a
w'

instance Semigroup a => Semigroup (V4 a) where
 <> :: V4 a -> V4 a -> V4 a
(<>) = (a -> a -> a) -> V4 a -> V4 a -> V4 a
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 (V4 a) where
  mempty :: V4 a
mempty = a -> V4 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