{-# 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
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,V4 a -> V4 a -> Bool
V4 a -> V4 a -> Ordering
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
Ord,Int -> V4 a -> ShowS
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)
ReadS [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,V4 a -> DataType
V4 a -> Constr
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 (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))
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(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 (m :: * -> *).
MonadPlus m =>
(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 (m :: * -> *).
Monad m =>
(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 :: forall u. 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 u. (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 :: forall r r'.
(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 :: forall r r'.
(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 (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(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 (t :: * -> *) (c :: * -> *).
Typeable t =>
(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 (c :: * -> *).
(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 (c :: * -> *).
(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)
Data
                                    ,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. 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)
                                    ,forall a (m :: * -> *). (Lift a, Quote m) => V4 a -> m Exp
forall a (m :: * -> *). (Lift a, Quote m) => V4 a -> Code m (V4 a)
forall t.
(forall (m :: * -> *). Quote m => t -> m Exp)
-> (forall (m :: * -> *). Quote m => t -> Code m t) -> Lift t
forall (m :: * -> *). Quote m => V4 a -> m Exp
forall (m :: * -> *). Quote m => V4 a -> Code m (V4 a)
liftTyped :: forall (m :: * -> *). Quote m => V4 a -> Code m (V4 a)
$cliftTyped :: forall a (m :: * -> *). (Lift a, Quote m) => V4 a -> Code m (V4 a)
lift :: forall (m :: * -> *). Quote m => V4 a -> m Exp
$clift :: forall a (m :: * -> *). (Lift a, Quote m) => V4 a -> m Exp
Lift
#endif
                                    )

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

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

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

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

instance Traversable V4 where
  traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> V4 a -> f (V4 b)
traverse a -> f b
f (V4 a
a a
b a
c a
d) = forall a. a -> a -> a -> a -> V4 a
V4 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f b
f a
a forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
b forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> a -> f b
f a
c 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 :: forall m a. Semigroup m => (a -> m) -> V4 a -> m
foldMap1 a -> m
f (V4 a
a a
b a
c a
d) = a -> m
f a
a forall a. Semigroup a => a -> a -> a
<> a -> m
f a
b forall a. Semigroup a => a -> a -> a
<> a -> m
f a
c forall a. Semigroup a => a -> a -> a
<> a -> m
f a
d
  {-# INLINE foldMap1 #-}

instance Traversable1 V4 where
  traverse1 :: forall (f :: * -> *) a b. Apply f => (a -> f b) -> V4 a -> f (V4 b)
traverse1 a -> f b
f (V4 a
a a
b a
c a
d) = forall a. a -> a -> a -> a -> V4 a
V4 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f b
f a
a forall (f :: * -> *) a b. Apply f => f (a -> b) -> f a -> f b
<.> a -> f b
f a
b forall (f :: * -> *) a b. Apply f => f (a -> b) -> f a -> f b
<.> a -> f b
f a
c 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 :: forall a. a -> V4 a
pure a
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 <*> :: forall a b. V4 (a -> b) -> V4 a -> V4 b
<*> V4 a
e a
f a
g a
h = 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 <.> :: forall a b. V4 (a -> b) -> V4 a -> V4 b
<.> V4 a
e a
f a
g a
h = 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 :: forall a. Num a => V4 a
zero = forall (f :: * -> *) a. Applicative f => a -> f a
pure a
0
  {-# INLINE zero #-}
  liftU2 :: forall a. (a -> a -> a) -> V4 a -> V4 a -> V4 a
liftU2 = 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) -> V4 a -> V4 b -> V4 c
liftI2 = 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 >>- :: forall a b. V4 a -> (a -> V4 b) -> V4 b
>>- a -> V4 b
f = 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 >>= :: forall a b. V4 a -> (a -> V4 b) -> V4 b
>>= a -> V4 b
f = 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
(+) = forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 forall a. Num a => a -> a -> a
(+)
  {-# INLINE (+) #-}
  * :: V4 a -> V4 a -> V4 a
(*) = forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 forall a. Num a => a -> a -> a
(*)
  {-# INLINE (-) #-}
  (-) = forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 (-)
  {-# INLINE (*) #-}
  negate :: V4 a -> V4 a
negate = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Num a => a -> a
negate
  {-# INLINE negate #-}
  abs :: V4 a -> V4 a
abs = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Num a => a -> a
abs
  {-# INLINE abs #-}
  signum :: V4 a -> V4 a
signum = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Num a => a -> a
signum
  {-# INLINE signum #-}
  fromInteger :: Integer -> V4 a
fromInteger = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Num a => Integer -> a
fromInteger
  {-# INLINE fromInteger #-}

instance Fractional a => Fractional (V4 a) where
  recip :: V4 a -> V4 a
recip = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Fractional a => a -> a
recip
  {-# INLINE recip #-}
  / :: V4 a -> V4 a -> V4 a
(/) = forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 forall a. Fractional a => a -> a -> a
(/)
  {-# INLINE (/) #-}
  fromRational :: Rational -> V4 a
fromRational = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Fractional a => Rational -> a
fromRational
  {-# INLINE fromRational #-}

instance Floating a => Floating (V4 a) where
    pi :: V4 a
pi = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a. Floating a => a
pi
    {-# INLINE pi #-}
    exp :: V4 a -> V4 a
exp = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Floating a => a -> a
exp
    {-# INLINE exp #-}
    sqrt :: V4 a -> V4 a
sqrt = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Floating a => a -> a
sqrt
    {-# INLINE sqrt #-}
    log :: V4 a -> V4 a
log = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Floating a => a -> a
log
    {-# INLINE log #-}
    ** :: V4 a -> V4 a -> V4 a
(**) = forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 forall a. Floating a => a -> a -> a
(**)
    {-# INLINE (**) #-}
    logBase :: V4 a -> V4 a -> V4 a
logBase = forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 forall a. Floating a => a -> a -> a
logBase
    {-# INLINE logBase #-}
    sin :: V4 a -> V4 a
sin = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Floating a => a -> a
sin
    {-# INLINE sin #-}
    tan :: V4 a -> V4 a
tan = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Floating a => a -> a
tan
    {-# INLINE tan #-}
    cos :: V4 a -> V4 a
cos = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Floating a => a -> a
cos
    {-# INLINE cos #-}
    asin :: V4 a -> V4 a
asin = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Floating a => a -> a
asin
    {-# INLINE asin #-}
    atan :: V4 a -> V4 a
atan = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Floating a => a -> a
atan
    {-# INLINE atan #-}
    acos :: V4 a -> V4 a
acos = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Floating a => a -> a
acos
    {-# INLINE acos #-}
    sinh :: V4 a -> V4 a
sinh = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Floating a => a -> a
sinh
    {-# INLINE sinh #-}
    tanh :: V4 a -> V4 a
tanh = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Floating a => a -> a
tanh
    {-# INLINE tanh #-}
    cosh :: V4 a -> V4 a
cosh = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Floating a => a -> a
cosh
    {-# INLINE cosh #-}
    asinh :: V4 a -> V4 a
asinh = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Floating a => a -> a
asinh
    {-# INLINE asinh #-}
    atanh :: V4 a -> V4 a
atanh = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Floating a => a -> a
atanh
    {-# INLINE atanh #-}
    acosh :: V4 a -> V4 a
acosh = forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap forall a. Floating a => a -> a
acosh
    {-# INLINE acosh #-}

instance Metric V4 where
  dot :: forall a. Num a => 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 forall a. Num a => a -> a -> a
* a
e forall a. Num a => a -> a -> a
+ a
b forall a. Num a => a -> a -> a
* a
f forall a. Num a => a -> a -> a
+ a
c forall a. Num a => a -> a -> a
* a
g forall a. Num a => a -> a -> a
+ a
d forall a. Num a => a -> a -> a
* a
h
  {-# INLINE dot #-}

instance Distributive V4 where
  distribute :: forall (f :: * -> *) a. Functor f => f (V4 a) -> V4 (f a)
distribute f (V4 a)
f = forall a. a -> a -> a -> a -> V4 a
V4 (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)
                    (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)
                    (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)
                    (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 forall a. Hashable a => Int -> a -> Int
`hashWithSalt` a
a forall a. Hashable a => Int -> a -> Int
`hashWithSalt` a
b forall a. Hashable a => Int -> a -> Int
`hashWithSalt` a
c forall a. Hashable a => Int -> a -> Int
`hashWithSalt` a
d
  {-# INLINE hashWithSalt #-}

instance Hashable1 V4 where
  liftHashWithSalt :: forall a. (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 :: forall (t :: * -> *) a. R4 t => Lens' (t a) (V2 a)
_xw V2 a -> f (V2 a)
f = forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V2 a -> f (V2 a)
f (forall a. a -> a -> V2 a
V2 a
a a
d) forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V2 a
a' a
d') -> forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b a
c a
d'
{-# INLINE _xw #-}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

_wzyx :: forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_wzyx V4 a -> f (V4 a)
f = forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw forall a b. (a -> b) -> a -> b
$ \(V4 a
a a
b a
c a
d) -> V4 a -> f (V4 a)
f (forall a. a -> a -> a -> a -> V4 a
V4 a
d a
c a
b a
a) forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \(V4 a
d' a
c' a
b' a
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 :: forall (t :: * -> *). R4 t => E t
ew = forall (t :: * -> *). (forall x. Lens' (t x) x) -> E t
E forall (t :: * -> *) a. R4 t => Lens' (t a) a
_w

instance R1 V4 where
  _x :: forall a. Lens' (V4 a) a
_x a -> f a
f (V4 a
a a
b a
c a
d) = (\a
a' -> forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b a
c a
d) 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 :: forall a. Lens' (V4 a) a
_y a -> f a
f (V4 a
a a
b a
c a
d) = (\a
b' -> forall a. a -> a -> a -> a -> V4 a
V4 a
a a
b' a
c a
d) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> a -> f a
f a
b
  {-# INLINE _y #-}
  _xy :: forall a. Lens' (V4 a) (V2 a)
_xy V2 a -> f (V2 a)
f (V4 a
a a
b a
c a
d) = (\(V2 a
a' a
b') -> forall a. a -> a -> a -> a -> V4 a
V4 a
a' a
b' a
c a
d) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> V2 a -> f (V2 a)
f (forall a. a -> a -> V2 a
V2 a
a a
b)
  {-# INLINE _xy #-}

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

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

instance Storable a => Storable (V4 a) where
  sizeOf :: V4 a -> Int
sizeOf V4 a
_ = Int
4 forall a. Num a => a -> a -> a
* forall a. Storable a => a -> Int
sizeOf (forall a. HasCallStack => a
undefined::a)
  {-# INLINE sizeOf #-}
  alignment :: V4 a -> Int
alignment V4 a
_ = forall a. Storable a => a -> Int
alignment (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 forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr a
ptr' a
x
                             forall a. Storable a => Ptr a -> Int -> a -> IO ()
pokeElemOff Ptr a
ptr' Int
1 a
y
                             forall a. Storable a => Ptr a -> Int -> a -> IO ()
pokeElemOff Ptr a
ptr' Int
2 a
z
                             forall a. Storable a => Ptr a -> Int -> a -> IO ()
pokeElemOff Ptr a
ptr' Int
3 a
w
    where ptr' :: Ptr a
ptr' = 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 = forall a. a -> a -> a -> a -> V4 a
V4 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a. Storable a => Ptr a -> IO a
peek Ptr a
ptr' forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall a. Storable a => Ptr a -> Int -> IO a
peekElemOff Ptr a
ptr' Int
1
                forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall a. Storable a => Ptr a -> Int -> IO a
peekElemOff Ptr a
ptr' Int
2 forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> forall a. Storable a => Ptr a -> Int -> IO a
peekElemOff Ptr a
ptr' Int
3
    where ptr' :: Ptr a
ptr' = 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 :: forall a. Num a => V3 a -> V4 a
vector (V3 a
a a
b a
c) = 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 :: forall a. Num a => V3 a -> V4 a
point (V3 a
a a
b a
c) = 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 :: forall a. Fractional a => V4 a -> V3 a
normalizePoint (V4 a
a a
b a
c a
w) = (a
1forall a. Fractional a => a -> a -> a
/a
w) forall (f :: * -> *) a. (Functor f, Num a) => a -> f a -> f 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 = forall a. Epsilon a => a -> Bool
nearZero forall b c a. (b -> c) -> (a -> b) -> a -> c
. 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) =
    [forall a. a -> a -> a -> a -> V4 a
V4 a
i1 a
i2 a
i3 a
i4 | a
i1 <- forall a. Ix a => (a, a) -> [a]
range (a
l1,a
u1)
                    , a
i2 <- forall a. Ix a => (a, a) -> [a]
range (a
l2,a
u2)
                    , a
i3 <- forall a. Ix a => (a, a) -> [a]
range (a
l3,a
u3)
                    , a
i4 <- 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) =
    forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a
l4,a
u4) a
i4 forall a. Num a => a -> a -> a
+ forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a
l4,a
u4) forall a. Num a => a -> a -> a
* (
    forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a
l3,a
u3) a
i3 forall a. Num a => a -> a -> a
+ forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a
l3,a
u3) forall a. Num a => a -> a -> a
* (
    forall a. Ix a => (a, a) -> a -> Int
unsafeIndex (a
l2,a
u2) a
i2 forall a. Num a => a -> a -> a
+ forall a. Ix a => (a, a) -> Int
unsafeRangeSize (a
l2,a
u2) forall a. Num a => a -> a -> a
*
    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) =
    forall a. Ix a => (a, a) -> a -> Bool
inRange (a
l1,a
u1) a
i1 Bool -> Bool -> Bool
&& forall a. Ix a => (a, a) -> a -> Bool
inRange (a
l2,a
u2) a
i2 Bool -> Bool -> Bool
&&
    forall a. Ix a => (a, a) -> a -> Bool
inRange (a
l3,a
u3) a
i3 Bool -> Bool -> 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 :: forall a. (Rep V4 -> a) -> V4 a
tabulate Rep V4 -> a
f = forall a. a -> a -> a -> a -> V4 a
V4 (Rep V4 -> a
f forall (t :: * -> *). R1 t => E t
ex) (Rep V4 -> a
f forall (t :: * -> *). R2 t => E t
ey) (Rep V4 -> a
f forall (t :: * -> *). R3 t => E t
ez) (Rep V4 -> a
f forall (t :: * -> *). R4 t => E t
ew)
  {-# INLINE tabulate #-}
  index :: forall a. V4 a -> Rep V4 -> a
index V4 a
xs (E forall a. Lens' (V4 a) a
l) = forall s (m :: * -> *) a. MonadReader s m => Getting a s a -> m a
view forall a. Lens' (V4 a) a
l V4 a
xs
  {-# INLINE index #-}

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

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

instance WithIndex.TraversableWithIndex (E V4) V4 where
  itraverse :: forall (f :: * -> *) a b.
Applicative f =>
(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) = forall a. a -> a -> a -> a -> V4 a
V4 forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> E V4 -> a -> f b
f forall (t :: * -> *). R1 t => E t
ex a
a forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> E V4 -> a -> f b
f forall (t :: * -> *). R2 t => E t
ey a
b forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> E V4 -> a -> f b
f forall (t :: * -> *). R3 t => E t
ez a
c forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> E V4 -> a -> f b
f 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 = forall (t :: * -> *). E t -> forall x. Lens' (t x) x
el Index (V4 a)
i

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

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

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

instance MonadFix V4 where
  mfix :: forall a. (a -> V4 a) -> V4 a
mfix a -> V4 a
f = 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 = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a. Bounded a => a
minBound
  {-# INLINE minBound #-}
  maxBound :: V4 a
maxBound = forall (f :: * -> *) a. Applicative f => a -> f a
pure 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) = forall a. NFData a => a -> ()
rnf a
a seq :: forall a b. a -> b -> b
`seq` forall a. NFData a => a -> ()
rnf a
b seq :: forall a b. a -> b -> b
`seq` forall a. NFData a => a -> ()
rnf a
c seq :: forall a b. a -> b -> b
`seq` forall a. NFData a => a -> ()
rnf a
d

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

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

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

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

instance Eq1 V4 where
  liftEq :: forall a b. (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 :: forall a b. (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 forall a. Monoid a => a -> a -> a
`mappend` a -> b -> Ordering
k a
b b
f forall a. Monoid a => a -> a -> a
`mappend` a -> b -> Ordering
k a
c b
g forall a. Monoid a => a -> a -> a
`mappend` a -> b -> Ordering
k a
d b
h
instance Read1 V4 where
  liftReadsPrec :: forall a. (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (V4 a)
liftReadsPrec Int -> ReadS a
k ReadS [a]
_ Int
z = forall a. Bool -> ReadS a -> ReadS a
readParen (Int
z forall a. Ord a => a -> a -> Bool
> Int
10) forall a b. (a -> b) -> a -> b
$ \String
r ->
     [ (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 :: forall a.
(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 forall a. Ord a => a -> a -> Bool
> Int
10) forall a b. (a -> b) -> a -> b
$
     String -> ShowS
showString String
"V4 " forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> a -> ShowS
f Int
11 a
a forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> ShowS
showChar Char
' ' forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> a -> ShowS
f Int
11 a
b forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> ShowS
showChar Char
' ' forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> a -> ShowS
f Int
11 a
c forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> ShowS
showChar Char
' ' 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 :: Lens (V4 a) (V4 a) a a
_1 a -> f a
f (V4 a
x a
y a
z a
w) = a -> f a
f a
x forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \a
x' -> 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 :: Lens (V4 a) (V4 a) a a
_2 a -> f a
f (V4 a
x a
y a
z a
w) = a -> f a
f a
y forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \a
y' -> 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 :: Lens (V4 a) (V4 a) a a
_3 a -> f a
f (V4 a
x a
y a
z a
w) = a -> f a
f a
z forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \a
z' -> 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 :: Lens (V4 a) (V4 a) a a
_4 a -> f a
f (V4 a
x a
y a
z a
w) = a -> f a
f a
w forall (f :: * -> *) a b. Functor f => f a -> (a -> b) -> f b
<&> \a
w' -> 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
(<>) = forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 forall a. Semigroup a => a -> a -> a
(<>)

instance Monoid a => Monoid (V4 a) where
  mempty :: V4 a
mempty = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a. Monoid a => a
mempty
#if !(MIN_VERSION_base(4,11,0))
  mappend = liftA2 mappend
#endif