{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE ScopedTypeVariables #-}

#ifndef MIN_VERSION_hashable
#define MIN_VERSION_hashable(x,y,z) 1
#endif

-----------------------------------------------------------------------------

-- |

-- License     :  BSD-style (see the file LICENSE)

-- Maintainer  :  Edward Kmett <ekmett@gmail.com>

-- Stability   :  provisional

-- Portability :  portable

--

-- Operations on affine spaces.

-----------------------------------------------------------------------------

module Linear.Affine where

import Control.Applicative
import Control.DeepSeq
import Control.Monad (liftM)
import Control.Lens
import Data.Binary as Binary
import Data.Bytes.Serial
import Data.Coerce
import Data.Complex (Complex)
import Data.Data
import Data.Distributive
import Data.Foldable as Foldable
import Data.Functor.Bind
import Data.Functor.Classes
import Data.Functor.Product
import Data.Functor.Rep as Rep
import Data.HashMap.Lazy (HashMap)
import Data.Hashable
import Data.Hashable.Lifted
import Data.IntMap (IntMap)
import Data.Ix
import Data.Kind
import Data.Map (Map)
#if !(MIN_VERSION_base(4,11,0))
import Data.Semigroup (Semigroup)
#endif
import Data.Serialize as Cereal
import Data.Vector (Vector)
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.Storable
import GHC.Generics (Generic, Generic1)
import Linear.Epsilon
import Linear.Metric
import Linear.Plucker
import Linear.Quaternion
import Linear.V
import Linear.V0
import Linear.V1
import Linear.V2
import Linear.V3
import Linear.V4
import Linear.Vector
import System.Random (Random(..))

-- | An affine space is roughly a vector space in which we have

-- forgotten or at least pretend to have forgotten the origin.

--

-- > a .+^ (b .-. a)  =  b@

-- > (a .+^ u) .+^ v  =  a .+^ (u ^+^ v)@

-- > (a .-. b) ^+^ v  =  (a .+^ v) .-. q@

class Additive (Diff p) => Affine p where
  type Diff p :: Type -> Type

  infixl 6 .-.
  -- | Get the difference between two points as a vector offset.

  (.-.) :: Num a => p a -> p a -> Diff p a

  infixl 6 .+^
  -- | Add a vector offset to a point.

  (.+^) :: Num a => p a -> Diff p a -> p a

  infixl 6 .-^
  -- | Subtract a vector offset from a point.

  (.-^) :: Num a => p a -> Diff p a -> p a
  p a
p .-^ Diff p a
v = p a
p forall (p :: * -> *) a. (Affine p, Num a) => p a -> Diff p a -> p a
.+^ forall (f :: * -> *) a. (Functor f, Num a) => f a -> f a
negated Diff p a
v
  {-# INLINE (.-^) #-}

instance (Affine f, Affine g) => Affine (Product f g) where
  type Diff (Product f g) = Product (Diff f) (Diff g)
  Pair f a
a g a
b .-. :: forall a.
Num a =>
Product f g a -> Product f g a -> Diff (Product f g) a
.-. Pair f a
c g a
d = forall {k} (f :: k -> *) (g :: k -> *) (a :: k).
f a -> g a -> Product f g a
Pair (f a
a forall (p :: * -> *) a. (Affine p, Num a) => p a -> p a -> Diff p a
.-. f a
c) (g a
b forall (p :: * -> *) a. (Affine p, Num a) => p a -> p a -> Diff p a
.-. g a
d)
  Pair f a
a g a
b .+^ :: forall a.
Num a =>
Product f g a -> Diff (Product f g) a -> Product f g a
.+^ Pair Diff f a
c Diff g a
d = forall {k} (f :: k -> *) (g :: k -> *) (a :: k).
f a -> g a -> Product f g a
Pair (f a
a forall (p :: * -> *) a. (Affine p, Num a) => p a -> Diff p a -> p a
.+^ Diff f a
c) (g a
b forall (p :: * -> *) a. (Affine p, Num a) => p a -> Diff p a -> p a
.+^ Diff g a
d)
  Pair f a
a g a
b .-^ :: forall a.
Num a =>
Product f g a -> Diff (Product f g) a -> Product f g a
.-^ Pair Diff f a
c Diff g a
d = forall {k} (f :: k -> *) (g :: k -> *) (a :: k).
f a -> g a -> Product f g a
Pair (f a
a forall (p :: * -> *) a. (Affine p, Num a) => p a -> Diff p a -> p a
.+^ Diff f a
c) (g a
b forall (p :: * -> *) a. (Affine p, Num a) => p a -> Diff p a -> p a
.+^ Diff g a
d)

-- | Compute the quadrance of the difference (the square of the distance)

qdA :: (Affine p, Foldable (Diff p), Num a) => p a -> p a -> a
qdA :: forall (p :: * -> *) a.
(Affine p, Foldable (Diff p), Num a) =>
p a -> p a -> a
qdA p a
a p a
b = forall (t :: * -> *) a. (Foldable t, Num a) => t a -> a
Foldable.sum (forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (forall (m :: * -> *) a. Bind m => m (m a) -> m a
join forall a. Num a => a -> a -> a
(*)) (p a
a forall (p :: * -> *) a. (Affine p, Num a) => p a -> p a -> Diff p a
.-. p a
b))
{-# INLINE qdA #-}

-- | Distance between two points in an affine space

distanceA :: (Floating a, Foldable (Diff p), Affine p) => p a -> p a -> a
distanceA :: forall a (p :: * -> *).
(Floating a, Foldable (Diff p), Affine p) =>
p a -> p a -> a
distanceA p a
a p a
b = forall a. Floating a => a -> a
sqrt (forall (p :: * -> *) a.
(Affine p, Foldable (Diff p), Num a) =>
p a -> p a -> a
qdA p a
a p a
b)
{-# INLINE distanceA #-}

#define ADDITIVEC(CTX,T) instance CTX => Affine T where type Diff T = T ; \
  (.-.) = (^-^) ; {-# INLINE (.-.) #-} ; (.+^) = (^+^) ; {-# INLINE (.+^) #-} ; \
  (.-^) = (^-^) ; {-# INLINE (.-^) #-}
#define ADDITIVE(T) ADDITIVEC((), T)

ADDITIVE([])
ADDITIVE(Complex)
ADDITIVE(ZipList)
ADDITIVE(Maybe)
ADDITIVE(IntMap)
ADDITIVE(Identity)
ADDITIVE(Vector)
ADDITIVE(V0)
ADDITIVE(V1)
ADDITIVE(V2)
ADDITIVE(V3)
ADDITIVE(V4)
ADDITIVE(Plucker)
ADDITIVE(Quaternion)
ADDITIVE(((->) b))
ADDITIVEC(Ord k, (Map k))
ADDITIVEC((Eq k, Hashable k), (HashMap k))
ADDITIVEC(Dim n, (V n))

-- | A handy wrapper to help distinguish points from vectors at the

-- type level

newtype Point f a = P (f a)
  deriving ( Point f a -> Point f a -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
forall (f :: * -> *) a. Eq (f a) => Point f a -> Point f a -> Bool
/= :: Point f a -> Point f a -> Bool
$c/= :: forall (f :: * -> *) a. Eq (f a) => Point f a -> Point f a -> Bool
== :: Point f a -> Point f a -> Bool
$c== :: forall (f :: * -> *) a. Eq (f a) => Point f a -> Point f a -> Bool
Eq, Point f a -> Point f a -> Bool
Point f a -> Point f a -> Ordering
Point f a -> Point f a -> Point f 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 {f :: * -> *} {a}. Ord (f a) => Eq (Point f a)
forall (f :: * -> *) a. Ord (f a) => Point f a -> Point f a -> Bool
forall (f :: * -> *) a.
Ord (f a) =>
Point f a -> Point f a -> Ordering
forall (f :: * -> *) a.
Ord (f a) =>
Point f a -> Point f a -> Point f a
min :: Point f a -> Point f a -> Point f a
$cmin :: forall (f :: * -> *) a.
Ord (f a) =>
Point f a -> Point f a -> Point f a
max :: Point f a -> Point f a -> Point f a
$cmax :: forall (f :: * -> *) a.
Ord (f a) =>
Point f a -> Point f a -> Point f a
>= :: Point f a -> Point f a -> Bool
$c>= :: forall (f :: * -> *) a. Ord (f a) => Point f a -> Point f a -> Bool
> :: Point f a -> Point f a -> Bool
$c> :: forall (f :: * -> *) a. Ord (f a) => Point f a -> Point f a -> Bool
<= :: Point f a -> Point f a -> Bool
$c<= :: forall (f :: * -> *) a. Ord (f a) => Point f a -> Point f a -> Bool
< :: Point f a -> Point f a -> Bool
$c< :: forall (f :: * -> *) a. Ord (f a) => Point f a -> Point f a -> Bool
compare :: Point f a -> Point f a -> Ordering
$ccompare :: forall (f :: * -> *) a.
Ord (f a) =>
Point f a -> Point f a -> Ordering
Ord, Int -> Point f a -> ShowS
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
forall (f :: * -> *) a. Show (f a) => Int -> Point f a -> ShowS
forall (f :: * -> *) a. Show (f a) => [Point f a] -> ShowS
forall (f :: * -> *) a. Show (f a) => Point f a -> String
showList :: [Point f a] -> ShowS
$cshowList :: forall (f :: * -> *) a. Show (f a) => [Point f a] -> ShowS
show :: Point f a -> String
$cshow :: forall (f :: * -> *) a. Show (f a) => Point f a -> String
showsPrec :: Int -> Point f a -> ShowS
$cshowsPrec :: forall (f :: * -> *) a. Show (f a) => Int -> Point f a -> ShowS
Show, ReadPrec [Point f a]
ReadPrec (Point f a)
ReadS [Point f a]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
forall (f :: * -> *) a. Read (f a) => ReadPrec [Point f a]
forall (f :: * -> *) a. Read (f a) => ReadPrec (Point f a)
forall (f :: * -> *) a. Read (f a) => Int -> ReadS (Point f a)
forall (f :: * -> *) a. Read (f a) => ReadS [Point f a]
readListPrec :: ReadPrec [Point f a]
$creadListPrec :: forall (f :: * -> *) a. Read (f a) => ReadPrec [Point f a]
readPrec :: ReadPrec (Point f a)
$creadPrec :: forall (f :: * -> *) a. Read (f a) => ReadPrec (Point f a)
readList :: ReadS [Point f a]
$creadList :: forall (f :: * -> *) a. Read (f a) => ReadS [Point f a]
readsPrec :: Int -> ReadS (Point f a)
$creadsPrec :: forall (f :: * -> *) a. Read (f a) => Int -> ReadS (Point f a)
Read, forall a. a -> Point f a
forall a b. Point f a -> Point f b -> Point f b
forall a b. Point f a -> (a -> Point f b) -> Point f b
forall {f :: * -> *}. Monad f => Applicative (Point f)
forall (f :: * -> *) a. Monad f => a -> Point f a
forall (f :: * -> *) a b.
Monad f =>
Point f a -> Point f b -> Point f b
forall (f :: * -> *) a b.
Monad f =>
Point f a -> (a -> Point f b) -> Point f b
forall (m :: * -> *).
Applicative m
-> (forall a b. m a -> (a -> m b) -> m b)
-> (forall a b. m a -> m b -> m b)
-> (forall a. a -> m a)
-> Monad m
return :: forall a. a -> Point f a
$creturn :: forall (f :: * -> *) a. Monad f => a -> Point f a
>> :: forall a b. Point f a -> Point f b -> Point f b
$c>> :: forall (f :: * -> *) a b.
Monad f =>
Point f a -> Point f b -> Point f b
>>= :: forall a b. Point f a -> (a -> Point f b) -> Point f b
$c>>= :: forall (f :: * -> *) a b.
Monad f =>
Point f a -> (a -> Point f b) -> Point f b
Monad, forall a b. a -> Point f b -> Point f a
forall a b. (a -> b) -> Point f a -> Point f b
forall (f :: * -> *) a b. Functor f => a -> Point f b -> Point f a
forall (f :: * -> *) a b.
Functor f =>
(a -> b) -> Point f a -> Point f b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: forall a b. a -> Point f b -> Point f a
$c<$ :: forall (f :: * -> *) a b. Functor f => a -> Point f b -> Point f a
fmap :: forall a b. (a -> b) -> Point f a -> Point f b
$cfmap :: forall (f :: * -> *) a b.
Functor f =>
(a -> b) -> Point f a -> Point f b
Functor, forall a. a -> Point f a
forall a b. Point f a -> Point f b -> Point f a
forall a b. Point f a -> Point f b -> Point f b
forall a b. Point f (a -> b) -> Point f a -> Point f b
forall a b c. (a -> b -> c) -> Point f a -> Point f b -> Point f c
forall (f :: * -> *).
Functor f
-> (forall a. a -> f a)
-> (forall a b. f (a -> b) -> f a -> f b)
-> (forall a b c. (a -> b -> c) -> f a -> f b -> f c)
-> (forall a b. f a -> f b -> f b)
-> (forall a b. f a -> f b -> f a)
-> Applicative f
forall {f :: * -> *}. Applicative f => Functor (Point f)
forall (f :: * -> *) a. Applicative f => a -> Point f a
forall (f :: * -> *) a b.
Applicative f =>
Point f a -> Point f b -> Point f a
forall (f :: * -> *) a b.
Applicative f =>
Point f a -> Point f b -> Point f b
forall (f :: * -> *) a b.
Applicative f =>
Point f (a -> b) -> Point f a -> Point f b
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> Point f a -> Point f b -> Point f c
<* :: forall a b. Point f a -> Point f b -> Point f a
$c<* :: forall (f :: * -> *) a b.
Applicative f =>
Point f a -> Point f b -> Point f a
*> :: forall a b. Point f a -> Point f b -> Point f b
$c*> :: forall (f :: * -> *) a b.
Applicative f =>
Point f a -> Point f b -> Point f b
liftA2 :: forall a b c. (a -> b -> c) -> Point f a -> Point f b -> Point f c
$cliftA2 :: forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> Point f a -> Point f b -> Point f c
<*> :: forall a b. Point f (a -> b) -> Point f a -> Point f b
$c<*> :: forall (f :: * -> *) a b.
Applicative f =>
Point f (a -> b) -> Point f a -> Point f b
pure :: forall a. a -> Point f a
$cpure :: forall (f :: * -> *) a. Applicative f => a -> Point f a
Applicative, forall a. Eq a => a -> Point f a -> Bool
forall a. Num a => Point f a -> a
forall a. Ord a => Point f a -> a
forall m. Monoid m => Point f m -> m
forall a. Point f a -> Bool
forall a. Point f a -> Int
forall a. Point f a -> [a]
forall a. (a -> a -> a) -> Point f a -> a
forall m a. Monoid m => (a -> m) -> Point f a -> m
forall b a. (b -> a -> b) -> b -> Point f a -> b
forall a b. (a -> b -> b) -> b -> Point f a -> b
forall (f :: * -> *) a.
(Foldable f, Eq a) =>
a -> Point f a -> Bool
forall (f :: * -> *) a. (Foldable f, Num a) => Point f a -> a
forall (f :: * -> *) a. (Foldable f, Ord a) => Point f a -> a
forall (f :: * -> *) m. (Foldable f, Monoid m) => Point f m -> m
forall (f :: * -> *) a. Foldable f => Point f a -> Bool
forall (f :: * -> *) a. Foldable f => Point f a -> Int
forall (f :: * -> *) a. Foldable f => Point f a -> [a]
forall (f :: * -> *) a.
Foldable f =>
(a -> a -> a) -> Point f a -> a
forall (f :: * -> *) m a.
(Foldable f, Monoid m) =>
(a -> m) -> Point f a -> m
forall (f :: * -> *) b a.
Foldable f =>
(b -> a -> b) -> b -> Point f a -> b
forall (f :: * -> *) a b.
Foldable f =>
(a -> b -> b) -> b -> Point f a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: forall a. Num a => Point f a -> a
$cproduct :: forall (f :: * -> *) a. (Foldable f, Num a) => Point f a -> a
sum :: forall a. Num a => Point f a -> a
$csum :: forall (f :: * -> *) a. (Foldable f, Num a) => Point f a -> a
minimum :: forall a. Ord a => Point f a -> a
$cminimum :: forall (f :: * -> *) a. (Foldable f, Ord a) => Point f a -> a
maximum :: forall a. Ord a => Point f a -> a
$cmaximum :: forall (f :: * -> *) a. (Foldable f, Ord a) => Point f a -> a
elem :: forall a. Eq a => a -> Point f a -> Bool
$celem :: forall (f :: * -> *) a.
(Foldable f, Eq a) =>
a -> Point f a -> Bool
length :: forall a. Point f a -> Int
$clength :: forall (f :: * -> *) a. Foldable f => Point f a -> Int
null :: forall a. Point f a -> Bool
$cnull :: forall (f :: * -> *) a. Foldable f => Point f a -> Bool
toList :: forall a. Point f a -> [a]
$ctoList :: forall (f :: * -> *) a. Foldable f => Point f a -> [a]
foldl1 :: forall a. (a -> a -> a) -> Point f a -> a
$cfoldl1 :: forall (f :: * -> *) a.
Foldable f =>
(a -> a -> a) -> Point f a -> a
foldr1 :: forall a. (a -> a -> a) -> Point f a -> a
$cfoldr1 :: forall (f :: * -> *) a.
Foldable f =>
(a -> a -> a) -> Point f a -> a
foldl' :: forall b a. (b -> a -> b) -> b -> Point f a -> b
$cfoldl' :: forall (f :: * -> *) b a.
Foldable f =>
(b -> a -> b) -> b -> Point f a -> b
foldl :: forall b a. (b -> a -> b) -> b -> Point f a -> b
$cfoldl :: forall (f :: * -> *) b a.
Foldable f =>
(b -> a -> b) -> b -> Point f a -> b
foldr' :: forall a b. (a -> b -> b) -> b -> Point f a -> b
$cfoldr' :: forall (f :: * -> *) a b.
Foldable f =>
(a -> b -> b) -> b -> Point f a -> b
foldr :: forall a b. (a -> b -> b) -> b -> Point f a -> b
$cfoldr :: forall (f :: * -> *) a b.
Foldable f =>
(a -> b -> b) -> b -> Point f a -> b
foldMap' :: forall m a. Monoid m => (a -> m) -> Point f a -> m
$cfoldMap' :: forall (f :: * -> *) m a.
(Foldable f, Monoid m) =>
(a -> m) -> Point f a -> m
foldMap :: forall m a. Monoid m => (a -> m) -> Point f a -> m
$cfoldMap :: forall (f :: * -> *) m a.
(Foldable f, Monoid m) =>
(a -> m) -> Point f a -> m
fold :: forall m. Monoid m => Point f m -> m
$cfold :: forall (f :: * -> *) m. (Foldable f, Monoid m) => Point f m -> m
Foldable
           , forall a b. (a -> b -> Bool) -> Point f a -> Point f b -> Bool
forall (f :: * -> *) a b.
Eq1 f =>
(a -> b -> Bool) -> Point f a -> Point f b -> Bool
forall (f :: * -> *).
(forall a b. (a -> b -> Bool) -> f a -> f b -> Bool) -> Eq1 f
liftEq :: forall a b. (a -> b -> Bool) -> Point f a -> Point f b -> Bool
$cliftEq :: forall (f :: * -> *) a b.
Eq1 f =>
(a -> b -> Bool) -> Point f a -> Point f b -> Bool
Eq1, forall a b.
(a -> b -> Ordering) -> Point f a -> Point f b -> Ordering
forall {f :: * -> *}. Ord1 f => Eq1 (Point f)
forall (f :: * -> *) a b.
Ord1 f =>
(a -> b -> Ordering) -> Point f a -> Point f b -> Ordering
forall (f :: * -> *).
Eq1 f
-> (forall a b. (a -> b -> Ordering) -> f a -> f b -> Ordering)
-> Ord1 f
liftCompare :: forall a b.
(a -> b -> Ordering) -> Point f a -> Point f b -> Ordering
$cliftCompare :: forall (f :: * -> *) a b.
Ord1 f =>
(a -> b -> Ordering) -> Point f a -> Point f b -> Ordering
Ord1, forall a.
(Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Point f a -> ShowS
forall a.
(Int -> a -> ShowS) -> ([a] -> ShowS) -> [Point f a] -> ShowS
forall (f :: * -> *) a.
Show1 f =>
(Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Point f a -> ShowS
forall (f :: * -> *) a.
Show1 f =>
(Int -> a -> ShowS) -> ([a] -> ShowS) -> [Point f a] -> ShowS
forall (f :: * -> *).
(forall a.
 (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> f a -> ShowS)
-> (forall a.
    (Int -> a -> ShowS) -> ([a] -> ShowS) -> [f a] -> ShowS)
-> Show1 f
liftShowList :: forall a.
(Int -> a -> ShowS) -> ([a] -> ShowS) -> [Point f a] -> ShowS
$cliftShowList :: forall (f :: * -> *) a.
Show1 f =>
(Int -> a -> ShowS) -> ([a] -> ShowS) -> [Point f a] -> ShowS
liftShowsPrec :: forall a.
(Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Point f a -> ShowS
$cliftShowsPrec :: forall (f :: * -> *) a.
Show1 f =>
(Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Point f a -> ShowS
Show1, forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec [Point f a]
forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec (Point f a)
forall a. (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Point f a)
forall a. (Int -> ReadS a) -> ReadS [a] -> ReadS [Point f a]
forall (f :: * -> *) a.
Read1 f =>
ReadPrec a -> ReadPrec [a] -> ReadPrec [Point f a]
forall (f :: * -> *) a.
Read1 f =>
ReadPrec a -> ReadPrec [a] -> ReadPrec (Point f a)
forall (f :: * -> *) a.
Read1 f =>
(Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Point f a)
forall (f :: * -> *) a.
Read1 f =>
(Int -> ReadS a) -> ReadS [a] -> ReadS [Point f a]
forall (f :: * -> *).
(forall a. (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (f a))
-> (forall a. (Int -> ReadS a) -> ReadS [a] -> ReadS [f a])
-> (forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec (f a))
-> (forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec [f a])
-> Read1 f
liftReadListPrec :: forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec [Point f a]
$cliftReadListPrec :: forall (f :: * -> *) a.
Read1 f =>
ReadPrec a -> ReadPrec [a] -> ReadPrec [Point f a]
liftReadPrec :: forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec (Point f a)
$cliftReadPrec :: forall (f :: * -> *) a.
Read1 f =>
ReadPrec a -> ReadPrec [a] -> ReadPrec (Point f a)
liftReadList :: forall a. (Int -> ReadS a) -> ReadS [a] -> ReadS [Point f a]
$cliftReadList :: forall (f :: * -> *) a.
Read1 f =>
(Int -> ReadS a) -> ReadS [a] -> ReadS [Point f a]
liftReadsPrec :: forall a. (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Point f a)
$cliftReadsPrec :: forall (f :: * -> *) a.
Read1 f =>
(Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Point f a)
Read1
           , forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall {f :: * -> *}. Traversable f => Functor (Point f)
forall {f :: * -> *}. Traversable f => Foldable (Point f)
forall (f :: * -> *) (m :: * -> *) a.
(Traversable f, Monad m) =>
Point f (m a) -> m (Point f a)
forall (f :: * -> *) (f :: * -> *) a.
(Traversable f, Applicative f) =>
Point f (f a) -> f (Point f a)
forall (f :: * -> *) (m :: * -> *) a b.
(Traversable f, Monad m) =>
(a -> m b) -> Point f a -> m (Point f b)
forall (f :: * -> *) (f :: * -> *) a b.
(Traversable f, Applicative f) =>
(a -> f b) -> Point f a -> f (Point f b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Point f a -> f (Point f b)
sequence :: forall (m :: * -> *) a. Monad m => Point f (m a) -> m (Point f a)
$csequence :: forall (f :: * -> *) (m :: * -> *) a.
(Traversable f, Monad m) =>
Point f (m a) -> m (Point f a)
mapM :: forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Point f a -> m (Point f b)
$cmapM :: forall (f :: * -> *) (m :: * -> *) a b.
(Traversable f, Monad m) =>
(a -> m b) -> Point f a -> m (Point f b)
sequenceA :: forall (f :: * -> *) a.
Applicative f =>
Point f (f a) -> f (Point f a)
$csequenceA :: forall (f :: * -> *) (f :: * -> *) a.
(Traversable f, Applicative f) =>
Point f (f a) -> f (Point f a)
traverse :: forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Point f a -> f (Point f b)
$ctraverse :: forall (f :: * -> *) (f :: * -> *) a b.
(Traversable f, Applicative f) =>
(a -> f b) -> Point f a -> f (Point f b)
Traversable, forall a b. Point f a -> Point f b -> Point f a
forall a b. Point f a -> Point f b -> Point f b
forall a b. Point f (a -> b) -> Point f a -> Point f b
forall a b c. (a -> b -> c) -> Point f a -> Point f b -> Point f c
forall (f :: * -> *).
Functor f
-> (forall a b. f (a -> b) -> f a -> f b)
-> (forall a b. f a -> f b -> f b)
-> (forall a b. f a -> f b -> f a)
-> (forall a b c. (a -> b -> c) -> f a -> f b -> f c)
-> Apply f
forall {f :: * -> *}. Apply f => Functor (Point f)
forall (f :: * -> *) a b.
Apply f =>
Point f a -> Point f b -> Point f a
forall (f :: * -> *) a b.
Apply f =>
Point f a -> Point f b -> Point f b
forall (f :: * -> *) a b.
Apply f =>
Point f (a -> b) -> Point f a -> Point f b
forall (f :: * -> *) a b c.
Apply f =>
(a -> b -> c) -> Point f a -> Point f b -> Point f c
liftF2 :: forall a b c. (a -> b -> c) -> Point f a -> Point f b -> Point f c
$cliftF2 :: forall (f :: * -> *) a b c.
Apply f =>
(a -> b -> c) -> Point f a -> Point f b -> Point f c
<. :: forall a b. Point f a -> Point f b -> Point f a
$c<. :: forall (f :: * -> *) a b.
Apply f =>
Point f a -> Point f b -> Point f a
.> :: forall a b. Point f a -> Point f b -> Point f b
$c.> :: forall (f :: * -> *) a b.
Apply f =>
Point f a -> Point f b -> Point f b
<.> :: forall a b. Point f (a -> b) -> Point f a -> Point f b
$c<.> :: forall (f :: * -> *) a b.
Apply f =>
Point f (a -> b) -> Point f a -> Point f b
Apply, forall a. Num a => Point f a
forall a. Num a => a -> Point f a -> Point f a -> Point f a
forall a. Num a => Point f a -> Point f a -> Point f a
forall a. (a -> a -> a) -> Point f a -> Point f a -> Point f a
forall a b c. (a -> b -> c) -> Point f a -> Point f b -> Point f c
forall (f :: * -> *).
Functor f
-> (forall a. Num a => f a)
-> (forall a. Num a => f a -> f a -> f a)
-> (forall a. Num a => f a -> f a -> f a)
-> (forall a. Num a => a -> f a -> f a -> f a)
-> (forall a. (a -> a -> a) -> f a -> f a -> f a)
-> (forall a b c. (a -> b -> c) -> f a -> f b -> f c)
-> Additive f
forall {f :: * -> *}. Additive f => Functor (Point f)
forall (f :: * -> *) a. (Additive f, Num a) => Point f a
forall (f :: * -> *) a.
(Additive f, Num a) =>
a -> Point f a -> Point f a -> Point f a
forall (f :: * -> *) a.
(Additive f, Num a) =>
Point f a -> Point f a -> Point f a
forall (f :: * -> *) a.
Additive f =>
(a -> a -> a) -> Point f a -> Point f a -> Point f a
forall (f :: * -> *) a b c.
Additive f =>
(a -> b -> c) -> Point f a -> Point f b -> Point f c
liftI2 :: forall a b c. (a -> b -> c) -> Point f a -> Point f b -> Point f c
$cliftI2 :: forall (f :: * -> *) a b c.
Additive f =>
(a -> b -> c) -> Point f a -> Point f b -> Point f c
liftU2 :: forall a. (a -> a -> a) -> Point f a -> Point f a -> Point f a
$cliftU2 :: forall (f :: * -> *) a.
Additive f =>
(a -> a -> a) -> Point f a -> Point f a -> Point f a
lerp :: forall a. Num a => a -> Point f a -> Point f a -> Point f a
$clerp :: forall (f :: * -> *) a.
(Additive f, Num a) =>
a -> Point f a -> Point f a -> Point f a
^-^ :: forall a. Num a => Point f a -> Point f a -> Point f a
$c^-^ :: forall (f :: * -> *) a.
(Additive f, Num a) =>
Point f a -> Point f a -> Point f a
^+^ :: forall a. Num a => Point f a -> Point f a -> Point f a
$c^+^ :: forall (f :: * -> *) a.
(Additive f, Num a) =>
Point f a -> Point f a -> Point f a
zero :: forall a. Num a => Point f a
$czero :: forall (f :: * -> *) a. (Additive f, Num a) => Point f a
Additive, forall a. Floating a => Point f a -> a
forall a. Floating a => Point f a -> Point f a
forall a. Floating a => Point f a -> Point f a -> a
forall a. Num a => Point f a -> a
forall a. Num a => Point f a -> Point f a -> a
forall (f :: * -> *).
Additive f
-> (forall a. Num a => f a -> f a -> a)
-> (forall a. Num a => f a -> a)
-> (forall a. Num a => f a -> f a -> a)
-> (forall a. Floating a => f a -> f a -> a)
-> (forall a. Floating a => f a -> a)
-> (forall a. Floating a => f a -> f a)
-> Metric f
forall {f :: * -> *}. Metric f => Additive (Point f)
forall (f :: * -> *) a. (Metric f, Floating a) => Point f a -> a
forall (f :: * -> *) a.
(Metric f, Floating a) =>
Point f a -> Point f a
forall (f :: * -> *) a.
(Metric f, Floating a) =>
Point f a -> Point f a -> a
forall (f :: * -> *) a. (Metric f, Num a) => Point f a -> a
forall (f :: * -> *) a.
(Metric f, Num a) =>
Point f a -> Point f a -> a
signorm :: forall a. Floating a => Point f a -> Point f a
$csignorm :: forall (f :: * -> *) a.
(Metric f, Floating a) =>
Point f a -> Point f a
norm :: forall a. Floating a => Point f a -> a
$cnorm :: forall (f :: * -> *) a. (Metric f, Floating a) => Point f a -> a
distance :: forall a. Floating a => Point f a -> Point f a -> a
$cdistance :: forall (f :: * -> *) a.
(Metric f, Floating a) =>
Point f a -> Point f a -> a
qd :: forall a. Num a => Point f a -> Point f a -> a
$cqd :: forall (f :: * -> *) a.
(Metric f, Num a) =>
Point f a -> Point f a -> a
quadrance :: forall a. Num a => Point f a -> a
$cquadrance :: forall (f :: * -> *) a. (Metric f, Num a) => Point f a -> a
dot :: forall a. Num a => Point f a -> Point f a -> a
$cdot :: forall (f :: * -> *) a.
(Metric f, Num a) =>
Point f a -> Point f a -> a
Metric
           , Rational -> Point f a
Point f a -> Point f a
Point f a -> Point f a -> Point f a
forall a.
Num a
-> (a -> a -> a) -> (a -> a) -> (Rational -> a) -> Fractional a
forall {f :: * -> *} {a}. Fractional (f a) => Num (Point f a)
forall (f :: * -> *) a. Fractional (f a) => Rational -> Point f a
forall (f :: * -> *) a. Fractional (f a) => Point f a -> Point f a
forall (f :: * -> *) a.
Fractional (f a) =>
Point f a -> Point f a -> Point f a
fromRational :: Rational -> Point f a
$cfromRational :: forall (f :: * -> *) a. Fractional (f a) => Rational -> Point f a
recip :: Point f a -> Point f a
$crecip :: forall (f :: * -> *) a. Fractional (f a) => Point f a -> Point f a
/ :: Point f a -> Point f a -> Point f a
$c/ :: forall (f :: * -> *) a.
Fractional (f a) =>
Point f a -> Point f a -> Point f a
Fractional , Integer -> Point f a
Point f a -> Point f a
Point f a -> Point f a -> Point f a
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
forall (f :: * -> *) a. Num (f a) => Integer -> Point f a
forall (f :: * -> *) a. Num (f a) => Point f a -> Point f a
forall (f :: * -> *) a.
Num (f a) =>
Point f a -> Point f a -> Point f a
fromInteger :: Integer -> Point f a
$cfromInteger :: forall (f :: * -> *) a. Num (f a) => Integer -> Point f a
signum :: Point f a -> Point f a
$csignum :: forall (f :: * -> *) a. Num (f a) => Point f a -> Point f a
abs :: Point f a -> Point f a
$cabs :: forall (f :: * -> *) a. Num (f a) => Point f a -> Point f a
negate :: Point f a -> Point f a
$cnegate :: forall (f :: * -> *) a. Num (f a) => Point f a -> Point f a
* :: Point f a -> Point f a -> Point f a
$c* :: forall (f :: * -> *) a.
Num (f a) =>
Point f a -> Point f a -> Point f a
- :: Point f a -> Point f a -> Point f a
$c- :: forall (f :: * -> *) a.
Num (f a) =>
Point f a -> Point f a -> Point f a
+ :: Point f a -> Point f a -> Point f a
$c+ :: forall (f :: * -> *) a.
Num (f a) =>
Point f a -> Point f a -> Point f a
Num, (Point f a, Point f a) -> Int
(Point f a, Point f a) -> [Point f a]
(Point f a, Point f a) -> Point f a -> Bool
(Point f a, Point f a) -> Point f a -> Int
forall a.
Ord a
-> ((a, a) -> [a])
-> ((a, a) -> a -> Int)
-> ((a, a) -> a -> Int)
-> ((a, a) -> a -> Bool)
-> ((a, a) -> Int)
-> ((a, a) -> Int)
-> Ix a
forall {f :: * -> *} {a}. Ix (f a) => Ord (Point f a)
forall (f :: * -> *) a. Ix (f a) => (Point f a, Point f a) -> Int
forall (f :: * -> *) a.
Ix (f a) =>
(Point f a, Point f a) -> [Point f a]
forall (f :: * -> *) a.
Ix (f a) =>
(Point f a, Point f a) -> Point f a -> Bool
forall (f :: * -> *) a.
Ix (f a) =>
(Point f a, Point f a) -> Point f a -> Int
unsafeRangeSize :: (Point f a, Point f a) -> Int
$cunsafeRangeSize :: forall (f :: * -> *) a. Ix (f a) => (Point f a, Point f a) -> Int
rangeSize :: (Point f a, Point f a) -> Int
$crangeSize :: forall (f :: * -> *) a. Ix (f a) => (Point f a, Point f a) -> Int
inRange :: (Point f a, Point f a) -> Point f a -> Bool
$cinRange :: forall (f :: * -> *) a.
Ix (f a) =>
(Point f a, Point f a) -> Point f a -> Bool
unsafeIndex :: (Point f a, Point f a) -> Point f a -> Int
$cunsafeIndex :: forall (f :: * -> *) a.
Ix (f a) =>
(Point f a, Point f a) -> Point f a -> Int
index :: (Point f a, Point f a) -> Point f a -> Int
$cindex :: forall (f :: * -> *) a.
Ix (f a) =>
(Point f a, Point f a) -> Point f a -> Int
range :: (Point f a, Point f a) -> [Point f a]
$crange :: forall (f :: * -> *) a.
Ix (f a) =>
(Point f a, Point f a) -> [Point f a]
Ix, Ptr (Point f a) -> IO (Point f a)
Ptr (Point f a) -> Int -> IO (Point f a)
Ptr (Point f a) -> Int -> Point f a -> IO ()
Ptr (Point f a) -> Point f a -> IO ()
Point f a -> Int
forall b. Ptr b -> Int -> IO (Point f a)
forall b. Ptr b -> Int -> Point f a -> IO ()
forall a.
(a -> Int)
-> (a -> Int)
-> (Ptr a -> Int -> IO a)
-> (Ptr a -> Int -> a -> IO ())
-> (forall b. Ptr b -> Int -> IO a)
-> (forall b. Ptr b -> Int -> a -> IO ())
-> (Ptr a -> IO a)
-> (Ptr a -> a -> IO ())
-> Storable a
forall (f :: * -> *) a.
Storable (f a) =>
Ptr (Point f a) -> IO (Point f a)
forall (f :: * -> *) a.
Storable (f a) =>
Ptr (Point f a) -> Int -> IO (Point f a)
forall (f :: * -> *) a.
Storable (f a) =>
Ptr (Point f a) -> Int -> Point f a -> IO ()
forall (f :: * -> *) a.
Storable (f a) =>
Ptr (Point f a) -> Point f a -> IO ()
forall (f :: * -> *) a. Storable (f a) => Point f a -> Int
forall (f :: * -> *) a b.
Storable (f a) =>
Ptr b -> Int -> IO (Point f a)
forall (f :: * -> *) a b.
Storable (f a) =>
Ptr b -> Int -> Point f a -> IO ()
poke :: Ptr (Point f a) -> Point f a -> IO ()
$cpoke :: forall (f :: * -> *) a.
Storable (f a) =>
Ptr (Point f a) -> Point f a -> IO ()
peek :: Ptr (Point f a) -> IO (Point f a)
$cpeek :: forall (f :: * -> *) a.
Storable (f a) =>
Ptr (Point f a) -> IO (Point f a)
pokeByteOff :: forall b. Ptr b -> Int -> Point f a -> IO ()
$cpokeByteOff :: forall (f :: * -> *) a b.
Storable (f a) =>
Ptr b -> Int -> Point f a -> IO ()
peekByteOff :: forall b. Ptr b -> Int -> IO (Point f a)
$cpeekByteOff :: forall (f :: * -> *) a b.
Storable (f a) =>
Ptr b -> Int -> IO (Point f a)
pokeElemOff :: Ptr (Point f a) -> Int -> Point f a -> IO ()
$cpokeElemOff :: forall (f :: * -> *) a.
Storable (f a) =>
Ptr (Point f a) -> Int -> Point f a -> IO ()
peekElemOff :: Ptr (Point f a) -> Int -> IO (Point f a)
$cpeekElemOff :: forall (f :: * -> *) a.
Storable (f a) =>
Ptr (Point f a) -> Int -> IO (Point f a)
alignment :: Point f a -> Int
$calignment :: forall (f :: * -> *) a. Storable (f a) => Point f a -> Int
sizeOf :: Point f a -> Int
$csizeOf :: forall (f :: * -> *) a. Storable (f a) => Point f a -> Int
Storable, Point f a -> Bool
forall a. Num a -> (a -> Bool) -> Epsilon a
forall {f :: * -> *} {a}. Epsilon (f a) => Num (Point f a)
forall (f :: * -> *) a. Epsilon (f a) => Point f a -> Bool
nearZero :: Point f a -> Bool
$cnearZero :: forall (f :: * -> *) a. Epsilon (f a) => Point f a -> Bool
Epsilon
           , NonEmpty (Point f a) -> Point f a
Point f a -> Point f a -> Point f a
forall b. Integral b => b -> Point f a -> Point f a
forall a.
(a -> a -> a)
-> (NonEmpty a -> a)
-> (forall b. Integral b => b -> a -> a)
-> Semigroup a
forall (f :: * -> *) a.
Semigroup (f a) =>
NonEmpty (Point f a) -> Point f a
forall (f :: * -> *) a.
Semigroup (f a) =>
Point f a -> Point f a -> Point f a
forall (f :: * -> *) a b.
(Semigroup (f a), Integral b) =>
b -> Point f a -> Point f a
stimes :: forall b. Integral b => b -> Point f a -> Point f a
$cstimes :: forall (f :: * -> *) a b.
(Semigroup (f a), Integral b) =>
b -> Point f a -> Point f a
sconcat :: NonEmpty (Point f a) -> Point f a
$csconcat :: forall (f :: * -> *) a.
Semigroup (f a) =>
NonEmpty (Point f a) -> Point f a
<> :: Point f a -> Point f a -> Point f a
$c<> :: forall (f :: * -> *) a.
Semigroup (f a) =>
Point f a -> Point f a -> Point f a
Semigroup, Point f a
[Point f a] -> Point f a
Point f a -> Point f a -> Point f a
forall a.
Semigroup a -> a -> (a -> a -> a) -> ([a] -> a) -> Monoid a
forall {f :: * -> *} {a}. Monoid (f a) => Semigroup (Point f a)
forall (f :: * -> *) a. Monoid (f a) => Point f a
forall (f :: * -> *) a. Monoid (f a) => [Point f a] -> Point f a
forall (f :: * -> *) a.
Monoid (f a) =>
Point f a -> Point f a -> Point f a
mconcat :: [Point f a] -> Point f a
$cmconcat :: forall (f :: * -> *) a. Monoid (f a) => [Point f a] -> Point f a
mappend :: Point f a -> Point f a -> Point f a
$cmappend :: forall (f :: * -> *) a.
Monoid (f a) =>
Point f a -> Point f a -> Point f a
mempty :: Point f a
$cmempty :: forall (f :: * -> *) a. Monoid (f a) => Point f a
Monoid
           , forall g. RandomGen g => g -> [Point f a]
forall g. RandomGen g => g -> (Point f a, g)
forall g. RandomGen g => (Point f a, Point f a) -> g -> [Point f a]
forall g.
RandomGen g =>
(Point f a, Point f a) -> g -> (Point f a, g)
forall a.
(forall g. RandomGen g => (a, a) -> g -> (a, g))
-> (forall g. RandomGen g => g -> (a, g))
-> (forall g. RandomGen g => (a, a) -> g -> [a])
-> (forall g. RandomGen g => g -> [a])
-> Random a
forall (f :: * -> *) a g.
(Random (f a), RandomGen g) =>
g -> [Point f a]
forall (f :: * -> *) a g.
(Random (f a), RandomGen g) =>
g -> (Point f a, g)
forall (f :: * -> *) a g.
(Random (f a), RandomGen g) =>
(Point f a, Point f a) -> g -> [Point f a]
forall (f :: * -> *) a g.
(Random (f a), RandomGen g) =>
(Point f a, Point f a) -> g -> (Point f a, g)
randoms :: forall g. RandomGen g => g -> [Point f a]
$crandoms :: forall (f :: * -> *) a g.
(Random (f a), RandomGen g) =>
g -> [Point f a]
randomRs :: forall g. RandomGen g => (Point f a, Point f a) -> g -> [Point f a]
$crandomRs :: forall (f :: * -> *) a g.
(Random (f a), RandomGen g) =>
(Point f a, Point f a) -> g -> [Point f a]
random :: forall g. RandomGen g => g -> (Point f a, g)
$crandom :: forall (f :: * -> *) a g.
(Random (f a), RandomGen g) =>
g -> (Point f a, g)
randomR :: forall g.
RandomGen g =>
(Point f a, Point f a) -> g -> (Point f a, g)
$crandomR :: forall (f :: * -> *) a g.
(Random (f a), RandomGen g) =>
(Point f a, Point f a) -> g -> (Point f a, g)
Random, Int -> Point f a -> Int
Point f a -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
forall {f :: * -> *} {a}. Hashable (f a) => Eq (Point f a)
forall (f :: * -> *) a. Hashable (f a) => Int -> Point f a -> Int
forall (f :: * -> *) a. Hashable (f a) => Point f a -> Int
hash :: Point f a -> Int
$chash :: forall (f :: * -> *) a. Hashable (f a) => Point f a -> Int
hashWithSalt :: Int -> Point f a -> Int
$chashWithSalt :: forall (f :: * -> *) a. Hashable (f a) => Int -> Point f a -> Int
Hashable
           , forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall (f :: * -> *) a x. Rep (Point f a) x -> Point f a
forall (f :: * -> *) a x. Point f a -> Rep (Point f a) x
$cto :: forall (f :: * -> *) a x. Rep (Point f a) x -> Point f a
$cfrom :: forall (f :: * -> *) a x. Point f a -> Rep (Point f a) x
Generic, forall k (f :: k -> *).
(forall (a :: k). f a -> Rep1 f a)
-> (forall (a :: k). Rep1 f a -> f a) -> Generic1 f
forall (f :: * -> *) a. Rep1 (Point f) a -> Point f a
forall (f :: * -> *) a. Point f a -> Rep1 (Point f) a
$cto1 :: forall (f :: * -> *) a. Rep1 (Point f) a -> Point f a
$cfrom1 :: forall (f :: * -> *) a. Point f a -> Rep1 (Point f) a
Generic1, Point f a -> DataType
Point f a -> Constr
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 (Point f a)
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Point f a -> c (Point f a)
forall {f :: * -> *} {a}.
(Typeable f, Typeable a, Data (f a)) =>
Typeable (Point f a)
forall (f :: * -> *) a.
(Typeable f, Typeable a, Data (f a)) =>
Point f a -> DataType
forall (f :: * -> *) a.
(Typeable f, Typeable a, Data (f a)) =>
Point f a -> Constr
forall (f :: * -> *) a.
(Typeable f, Typeable a, Data (f a)) =>
(forall b. Data b => b -> b) -> Point f a -> Point f a
forall (f :: * -> *) a u.
(Typeable f, Typeable a, Data (f a)) =>
Int -> (forall d. Data d => d -> u) -> Point f a -> u
forall (f :: * -> *) a u.
(Typeable f, Typeable a, Data (f a)) =>
(forall d. Data d => d -> u) -> Point f a -> [u]
forall (f :: * -> *) a r r'.
(Typeable f, Typeable a, Data (f a)) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Point f a -> r
forall (f :: * -> *) a r r'.
(Typeable f, Typeable a, Data (f a)) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Point f a -> r
forall (f :: * -> *) a (m :: * -> *).
(Typeable f, Typeable a, Data (f a), Monad m) =>
(forall d. Data d => d -> m d) -> Point f a -> m (Point f a)
forall (f :: * -> *) a (m :: * -> *).
(Typeable f, Typeable a, Data (f a), MonadPlus m) =>
(forall d. Data d => d -> m d) -> Point f a -> m (Point f a)
forall (f :: * -> *) a (c :: * -> *).
(Typeable f, Typeable a, Data (f a)) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Point f a)
forall (f :: * -> *) a (c :: * -> *).
(Typeable f, Typeable a, Data (f a)) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Point f a -> c (Point f a)
forall (f :: * -> *) a (t :: * -> *) (c :: * -> *).
(Typeable f, Typeable a, Data (f a), Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Point f a))
forall (f :: * -> *) a (t :: * -> * -> *) (c :: * -> *).
(Typeable f, Typeable a, Data (f a), Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Point f a))
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Point f a -> m (Point f a)
$cgmapMo :: forall (f :: * -> *) a (m :: * -> *).
(Typeable f, Typeable a, Data (f a), MonadPlus m) =>
(forall d. Data d => d -> m d) -> Point f a -> m (Point f a)
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Point f a -> m (Point f a)
$cgmapMp :: forall (f :: * -> *) a (m :: * -> *).
(Typeable f, Typeable a, Data (f a), MonadPlus m) =>
(forall d. Data d => d -> m d) -> Point f a -> m (Point f a)
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Point f a -> m (Point f a)
$cgmapM :: forall (f :: * -> *) a (m :: * -> *).
(Typeable f, Typeable a, Data (f a), Monad m) =>
(forall d. Data d => d -> m d) -> Point f a -> m (Point f a)
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> Point f a -> u
$cgmapQi :: forall (f :: * -> *) a u.
(Typeable f, Typeable a, Data (f a)) =>
Int -> (forall d. Data d => d -> u) -> Point f a -> u
gmapQ :: forall u. (forall d. Data d => d -> u) -> Point f a -> [u]
$cgmapQ :: forall (f :: * -> *) a u.
(Typeable f, Typeable a, Data (f a)) =>
(forall d. Data d => d -> u) -> Point f a -> [u]
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Point f a -> r
$cgmapQr :: forall (f :: * -> *) a r r'.
(Typeable f, Typeable a, Data (f a)) =>
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Point f a -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Point f a -> r
$cgmapQl :: forall (f :: * -> *) a r r'.
(Typeable f, Typeable a, Data (f a)) =>
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Point f a -> r
gmapT :: (forall b. Data b => b -> b) -> Point f a -> Point f a
$cgmapT :: forall (f :: * -> *) a.
(Typeable f, Typeable a, Data (f a)) =>
(forall b. Data b => b -> b) -> Point f a -> Point f a
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Point f a))
$cdataCast2 :: forall (f :: * -> *) a (t :: * -> * -> *) (c :: * -> *).
(Typeable f, Typeable a, Data (f a), Typeable t) =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Point f a))
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Point f a))
$cdataCast1 :: forall (f :: * -> *) a (t :: * -> *) (c :: * -> *).
(Typeable f, Typeable a, Data (f a), Typeable t) =>
(forall d. Data d => c (t d)) -> Maybe (c (Point f a))
dataTypeOf :: Point f a -> DataType
$cdataTypeOf :: forall (f :: * -> *) a.
(Typeable f, Typeable a, Data (f a)) =>
Point f a -> DataType
toConstr :: Point f a -> Constr
$ctoConstr :: forall (f :: * -> *) a.
(Typeable f, Typeable a, Data (f a)) =>
Point f a -> Constr
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Point f a)
$cgunfold :: forall (f :: * -> *) a (c :: * -> *).
(Typeable f, Typeable a, Data (f a)) =>
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Point f a)
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Point f a -> c (Point f a)
$cgfoldl :: forall (f :: * -> *) a (c :: * -> *).
(Typeable f, Typeable a, Data (f a)) =>
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> Point f a -> c (Point f a)
Data
           )

instance Finite f => Finite (Point f) where
  type Size (Point f) = Size f
  toV :: forall a. Point f a -> V (Size (Point f)) a
toV (P f a
v) = forall (v :: * -> *) a. Finite v => v a -> V (Size v) a
toV f a
v
  fromV :: forall a. V (Size (Point f)) a -> Point f a
fromV V (Size (Point f)) a
v = forall (f :: * -> *) a. f a -> Point f a
P (forall (v :: * -> *) a. Finite v => V (Size v) a -> v a
fromV V (Size (Point f)) a
v)

instance NFData (f a) => NFData (Point f a) where
  rnf :: Point f a -> ()
rnf (P f a
x) = forall a. NFData a => a -> ()
rnf f a
x

instance Serial1 f => Serial1 (Point f) where
  serializeWith :: forall (m :: * -> *) a.
MonadPut m =>
(a -> m ()) -> Point f a -> m ()
serializeWith a -> m ()
f (P f a
p) = forall (f :: * -> *) (m :: * -> *) a.
(Serial1 f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
serializeWith a -> m ()
f f a
p
  deserializeWith :: forall (m :: * -> *) a. MonadGet m => m a -> m (Point f a)
deserializeWith m a
m = forall (f :: * -> *) a. f a -> Point f a
P forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
`liftM` forall (f :: * -> *) (m :: * -> *) a.
(Serial1 f, MonadGet m) =>
m a -> m (f a)
deserializeWith m a
m

instance Serial (f a) => Serial (Point f a) where
  serialize :: forall (m :: * -> *). MonadPut m => Point f a -> m ()
serialize (P f a
p) = forall a (m :: * -> *). (Serial a, MonadPut m) => a -> m ()
serialize f a
p
  deserialize :: forall (m :: * -> *). MonadGet m => m (Point f a)
deserialize = forall (f :: * -> *) a. f a -> Point f a
P forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
`liftM` forall a (m :: * -> *). (Serial a, MonadGet m) => m a
deserialize

instance Binary (f a) => Binary (Point f a) where
  put :: Point f a -> Put
put (P f a
p) = forall t. Binary t => t -> Put
Binary.put f a
p
  get :: Get (Point f a)
get = forall (f :: * -> *) a. f a -> Point f a
P forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
`liftM` forall t. Binary t => Get t
Binary.get

instance Serialize (f a) => Serialize (Point f a) where
  put :: Putter (Point f a)
put (P f a
p) = forall t. Serialize t => Putter t
Cereal.put f a
p
  get :: Get (Point f a)
get = forall (f :: * -> *) a. f a -> Point f a
P forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
`liftM` forall t. Serialize t => Get t
Cereal.get

instance Hashable1 f => Hashable1 (Point f) where
  liftHashWithSalt :: forall a. (Int -> a -> Int) -> Int -> Point f a -> Int
liftHashWithSalt Int -> a -> Int
h Int
s (P f a
f) = forall (t :: * -> *) a.
Hashable1 t =>
(Int -> a -> Int) -> Int -> t a -> Int
liftHashWithSalt Int -> a -> Int
h Int
s f a
f
  {-# INLINE liftHashWithSalt #-}

lensP :: Lens (Point f a) (Point g b) (f a) (g b)
lensP :: forall (f :: * -> *) a (g :: * -> *) b.
Lens (Point f a) (Point g b) (f a) (g b)
lensP f a -> f (g b)
afb (P f a
a) = forall (f :: * -> *) a. f a -> Point f a
P forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> f a -> f (g b)
afb f a
a
{-# INLINE lensP #-}

_Point :: Iso (Point f a) (Point g b) (f a) (g b)
_Point :: forall (f :: * -> *) a (g :: * -> *) b.
Iso (Point f a) (Point g b) (f a) (g b)
_Point = forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(P f a
a) -> f a
a) forall (f :: * -> *) a. f a -> Point f a
P
{-# INLINE _Point #-}

instance (t ~ Point g b) => Rewrapped (Point f a) t
instance Wrapped (Point f a) where
  type Unwrapped (Point f a) = f a
  _Wrapped' :: Iso' (Point f a) (Unwrapped (Point f a))
_Wrapped' = forall (f :: * -> *) a (g :: * -> *) b.
Iso (Point f a) (Point g b) (f a) (g b)
_Point
  {-# INLINE _Wrapped' #-}

-- These are stolen from Data.Profunctor.Unsafe

(.#) :: Coercible b a => (b -> c) -> (a -> b) -> a -> c
b -> c
f .# :: forall b a c. Coercible b a => (b -> c) -> (a -> b) -> a -> c
.# a -> b
_ = coerce :: forall a b. Coercible a b => a -> b
coerce b -> c
f
{-# INLINE (.#) #-}

(#.) :: Coercible c b => (b -> c) -> (a -> b) -> a -> c
#. :: forall c b a. Coercible c b => (b -> c) -> (a -> b) -> a -> c
(#.) b -> c
_ = coerce :: forall a b. Coercible a b => a -> b
coerce (\b
x -> b
x :: b) :: forall a b. Coercible b a => a -> b
{-# INLINE (#.) #-}

unP :: Point f a -> f a
unP :: forall (f :: * -> *) a. Point f a -> f a
unP (P f a
x) = f a
x
{-# INLINE unP #-}

-- We can't use GND to derive 'Bind' because 'join' causes

-- role troubles. However, GHC 7.8 and above let us use

-- explicit coercions for (>>-).

instance Bind f => Bind (Point f) where
  >>- :: forall a b. Point f a -> (a -> Point f b) -> Point f b
(>>-) = ((forall (f :: * -> *) a. f a -> Point f a
P forall b c a. (b -> c) -> (a -> b) -> a -> c
.) forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall (f :: * -> *) a. Point f a -> f a
unP forall b c a. (b -> c) -> (a -> b) -> a -> c
.))) forall c b a. Coercible c b => (b -> c) -> (a -> b) -> a -> c
#. forall (m :: * -> *) a b. Bind m => m a -> (a -> m b) -> m b
(>>-) forall b a c. Coercible b a => (b -> c) -> (a -> b) -> a -> c
.# forall (f :: * -> *) a. Point f a -> f a
unP
  join :: forall a. Point f (Point f a) -> Point f a
join (P f (Point f a)
m) = forall (f :: * -> *) a. f a -> Point f a
P forall a b. (a -> b) -> a -> b
$ f (Point f a)
m forall (m :: * -> *) a b. Bind m => m a -> (a -> m b) -> m b
>>- \(P f a
m') -> f a
m'

instance Distributive f => Distributive (Point f) where
  distribute :: forall (f :: * -> *) a. Functor f => f (Point f a) -> Point f (f a)
distribute = forall (f :: * -> *) a. f a -> Point f a
P forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (g :: * -> *) (f :: * -> *) a b.
(Distributive g, Functor f) =>
(a -> g b) -> f a -> g (f b)
collect (\(P f a
p) -> f a
p)
  collect :: forall (f :: * -> *) a b.
Functor f =>
(a -> Point f b) -> f a -> Point f (f b)
collect = (forall (f :: * -> *) a. f a -> Point f a
P forall b c a. (b -> c) -> (a -> b) -> a -> c
.) forall c b a. Coercible c b => (b -> c) -> (a -> b) -> a -> c
#. forall (g :: * -> *) (f :: * -> *) a b.
(Distributive g, Functor f) =>
(a -> g b) -> f a -> g (f b)
collect forall b a c. Coercible b a => (b -> c) -> (a -> b) -> a -> c
.# (forall (f :: * -> *) a. Point f a -> f a
unP forall b c a. (b -> c) -> (a -> b) -> a -> c
.)

instance Representable f => Representable (Point f) where
  type Rep (Point f) = Rep f
  tabulate :: forall a. (Rep (Point f) -> a) -> Point f a
tabulate = forall (f :: * -> *) a. f a -> Point f a
P forall c b a. Coercible c b => (b -> c) -> (a -> b) -> a -> c
#. forall (f :: * -> *) a. Representable f => (Rep f -> a) -> f a
tabulate
  {-# INLINE tabulate #-}
  index :: forall a. Point f a -> Rep (Point f) -> a
index = forall (f :: * -> *) a. Representable f => f a -> Rep f -> a
Rep.index forall b a c. Coercible b a => (b -> c) -> (a -> b) -> a -> c
.# forall (f :: * -> *) a. Point f a -> f a
unP
  {-# INLINE index #-}

type instance Index (Point f a) = Index (f a)
type instance IxValue (Point f a) = IxValue (f a)

instance Ixed (f a) => Ixed (Point f a) where
  ix :: Index (Point f a) -> Traversal' (Point f a) (IxValue (Point f a))
ix Index (Point f a)
l = forall (f :: * -> *) a (g :: * -> *) b.
Lens (Point f a) (Point g b) (f a) (g b)
lensP forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall m. Ixed m => Index m -> Traversal' m (IxValue m)
ix Index (Point f a)
l
  {-# INLINE ix #-}

instance Traversable f => Each (Point f a) (Point f b) a b where
  each :: Traversal (Point f a) (Point f b) a b
each = forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
traverse
  {-# INLINE each #-}

instance R1 f => R1 (Point f) where
  _x :: forall a. Lens' (Point f a) a
_x = forall (f :: * -> *) a (g :: * -> *) b.
Lens (Point f a) (Point g b) (f a) (g b)
lensP forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: * -> *) a. R1 t => Lens' (t a) a
_x
  {-# INLINE _x #-}

instance R2 f => R2 (Point f) where
  _y :: forall a. Lens' (Point f a) a
_y = forall (f :: * -> *) a (g :: * -> *) b.
Lens (Point f a) (Point g b) (f a) (g b)
lensP forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: * -> *) a. R2 t => Lens' (t a) a
_y
  {-# INLINE _y #-}
  _xy :: forall a. Lens' (Point f a) (V2 a)
_xy = forall (f :: * -> *) a (g :: * -> *) b.
Lens (Point f a) (Point g b) (f a) (g b)
lensP forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: * -> *) a. R2 t => Lens' (t a) (V2 a)
_xy
  {-# INLINE _xy #-}

instance R3 f => R3 (Point f) where
  _z :: forall a. Lens' (Point f a) a
_z = forall (f :: * -> *) a (g :: * -> *) b.
Lens (Point f a) (Point g b) (f a) (g b)
lensP forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: * -> *) a. R3 t => Lens' (t a) a
_z
  {-# INLINE _z #-}
  _xyz :: forall a. Lens' (Point f a) (V3 a)
_xyz = forall (f :: * -> *) a (g :: * -> *) b.
Lens (Point f a) (Point g b) (f a) (g b)
lensP forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: * -> *) a. R3 t => Lens' (t a) (V3 a)
_xyz
  {-# INLINE _xyz #-}

instance R4 f => R4 (Point f) where
  _w :: forall a. Lens' (Point f a) a
_w = forall (f :: * -> *) a (g :: * -> *) b.
Lens (Point f a) (Point g b) (f a) (g b)
lensP forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: * -> *) a. R4 t => Lens' (t a) a
_w
  {-# INLINE _w #-}
  _xyzw :: forall a. Lens' (Point f a) (V4 a)
_xyzw = forall (f :: * -> *) a (g :: * -> *) b.
Lens (Point f a) (Point g b) (f a) (g b)
lensP forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (t :: * -> *) a. R4 t => Lens' (t a) (V4 a)
_xyzw
  {-# INLINE _xyzw #-}

instance Additive f => Affine (Point f) where
  type Diff (Point f) = f
  .-. :: forall a. Num a => Point f a -> Point f a -> Diff (Point f) a
(.-.) = (forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall (f :: * -> *) a. Point f a -> f a
unP) forall c b a. Coercible c b => (b -> c) -> (a -> b) -> a -> c
#. forall (f :: * -> *) a. (Additive f, Num a) => f a -> f a -> f a
(^-^) forall b a c. Coercible b a => (b -> c) -> (a -> b) -> a -> c
.# forall (f :: * -> *) a. Point f a -> f a
unP
  {-# INLINE (.-.) #-}
  .+^ :: forall a. Num a => Point f a -> Diff (Point f) a -> Point f a
(.+^) = (forall (f :: * -> *) a. f a -> Point f a
P forall b c a. (b -> c) -> (a -> b) -> a -> c
.) forall c b a. Coercible c b => (b -> c) -> (a -> b) -> a -> c
#. forall (f :: * -> *) a. (Additive f, Num a) => f a -> f a -> f a
(^+^) forall b a c. Coercible b a => (b -> c) -> (a -> b) -> a -> c
.# forall (f :: * -> *) a. Point f a -> f a
unP
  {-# INLINE (.+^) #-}
  .-^ :: forall a. Num a => Point f a -> Diff (Point f) a -> Point f a
(.-^) = (forall (f :: * -> *) a. f a -> Point f a
P forall b c a. (b -> c) -> (a -> b) -> a -> c
.) forall c b a. Coercible c b => (b -> c) -> (a -> b) -> a -> c
#. forall (f :: * -> *) a. (Additive f, Num a) => f a -> f a -> f a
(^-^) forall b a c. Coercible b a => (b -> c) -> (a -> b) -> a -> c
.# forall (f :: * -> *) a. Point f a -> f a
unP
  {-# INLINE (.-^) #-}

-- | Vector spaces have origins.

origin :: (Additive f, Num a) => Point f a
origin :: forall (f :: * -> *) a. (Additive f, Num a) => Point f a
origin = forall (f :: * -> *) a. f a -> Point f a
P forall (f :: * -> *) a. (Additive f, Num a) => f a
zero

-- | An isomorphism between points and vectors, given a reference

--   point.

relative :: (Additive f, Num a) => Point f a -> Iso' (Point f a) (f a)
relative :: forall (f :: * -> *) a.
(Additive f, Num a) =>
Point f a -> Iso' (Point f a) (f a)
relative Point f a
p0 = forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (forall (p :: * -> *) a. (Affine p, Num a) => p a -> p a -> Diff p a
.-. Point f a
p0) (Point f a
p0 forall (p :: * -> *) a. (Affine p, Num a) => p a -> Diff p a -> p a
.+^)
{-# INLINE relative #-}

newtype instance U.Vector    (Point f a) =  V_P (U.Vector    (f a))
newtype instance U.MVector s (Point f a) = MV_P (U.MVector s (f a))
instance U.Unbox (f a) => U.Unbox (Point f a)

instance U.Unbox (f a) => M.MVector U.MVector (Point f a) where
  {-# INLINE basicLength #-}
  {-# INLINE basicUnsafeSlice #-}
  {-# INLINE basicOverlaps #-}
  {-# INLINE basicUnsafeNew #-}
  {-# INLINE basicUnsafeRead #-}
  {-# INLINE basicUnsafeWrite #-}
  basicLength :: forall s. MVector s (Point f a) -> Int
basicLength (MV_P MVector s (f a)
v) = forall (v :: * -> * -> *) a s. MVector v a => v s a -> Int
M.basicLength MVector s (f a)
v
  basicUnsafeSlice :: forall s.
Int -> Int -> MVector s (Point f a) -> MVector s (Point f a)
basicUnsafeSlice Int
m Int
n (MV_P MVector s (f a)
v) = forall s (f :: * -> *) a. MVector s (f a) -> MVector s (Point f a)
MV_P (forall (v :: * -> * -> *) a s.
MVector v a =>
Int -> Int -> v s a -> v s a
M.basicUnsafeSlice Int
m Int
n MVector s (f a)
v)
  basicOverlaps :: forall s. MVector s (Point f a) -> MVector s (Point f a) -> Bool
basicOverlaps (MV_P MVector s (f a)
v) (MV_P MVector s (f a)
u) = forall (v :: * -> * -> *) a s.
MVector v a =>
v s a -> v s a -> Bool
M.basicOverlaps MVector s (f a)
v MVector s (f a)
u
  basicUnsafeNew :: forall s. Int -> ST s (MVector s (Point f a))
basicUnsafeNew Int
n = forall s (f :: * -> *) a. MVector s (f a) -> MVector s (Point f a)
MV_P forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
`liftM` forall (v :: * -> * -> *) a s. MVector v a => Int -> ST s (v s a)
M.basicUnsafeNew Int
n
  basicUnsafeRead :: forall s. MVector s (Point f a) -> Int -> ST s (Point f a)
basicUnsafeRead (MV_P MVector s (f a)
v) Int
i = forall (f :: * -> *) a. f a -> Point f a
P forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
`liftM` forall (v :: * -> * -> *) a s.
MVector v a =>
v s a -> Int -> ST s a
M.basicUnsafeRead MVector s (f a)
v Int
i
  basicUnsafeWrite :: forall s. MVector s (Point f a) -> Int -> Point f a -> ST s ()
basicUnsafeWrite (MV_P MVector s (f a)
v) Int
i (P f a
x) = forall (v :: * -> * -> *) a s.
MVector v a =>
v s a -> Int -> a -> ST s ()
M.basicUnsafeWrite MVector s (f a)
v Int
i f a
x
  basicInitialize :: forall s. MVector s (Point f a) -> ST s ()
basicInitialize (MV_P MVector s (f a)
v) = forall (v :: * -> * -> *) a s. MVector v a => v s a -> ST s ()
M.basicInitialize MVector s (f a)
v
  {-# INLINE basicInitialize #-}

instance U.Unbox (f a) => G.Vector U.Vector (Point f a) where
  {-# INLINE basicUnsafeFreeze #-}
  {-# INLINE basicUnsafeThaw   #-}
  {-# INLINE basicLength       #-}
  {-# INLINE basicUnsafeSlice  #-}
  {-# INLINE basicUnsafeIndexM #-}
  basicUnsafeFreeze :: forall s. Mutable Vector s (Point f a) -> ST s (Vector (Point f a))
basicUnsafeFreeze (MV_P MVector s (f a)
v) = forall (f :: * -> *) a. Vector (f a) -> Vector (Point f a)
V_P forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
`liftM` forall (v :: * -> *) a s. Vector v a => Mutable v s a -> ST s (v a)
G.basicUnsafeFreeze MVector s (f a)
v
  basicUnsafeThaw :: forall s. Vector (Point f a) -> ST s (Mutable Vector s (Point f a))
basicUnsafeThaw   ( V_P Vector (f a)
v) = forall s (f :: * -> *) a. MVector s (f a) -> MVector s (Point f a)
MV_P forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
`liftM` forall (v :: * -> *) a s. Vector v a => v a -> ST s (Mutable v s a)
G.basicUnsafeThaw   Vector (f a)
v
  basicLength :: Vector (Point f a) -> Int
basicLength       ( V_P Vector (f a)
v) = forall (v :: * -> *) a. Vector v a => v a -> Int
G.basicLength Vector (f a)
v
  basicUnsafeSlice :: Int -> Int -> Vector (Point f a) -> Vector (Point f a)
basicUnsafeSlice Int
m Int
n (V_P Vector (f a)
v) = forall (f :: * -> *) a. Vector (f a) -> Vector (Point f a)
V_P (forall (v :: * -> *) a. Vector v a => Int -> Int -> v a -> v a
G.basicUnsafeSlice Int
m Int
n Vector (f a)
v)
  basicUnsafeIndexM :: Vector (Point f a) -> Int -> Box (Point f a)
basicUnsafeIndexM (V_P Vector (f a)
v) Int
i = forall (f :: * -> *) a. f a -> Point f a
P forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
`liftM` forall (v :: * -> *) a. Vector v a => v a -> Int -> Box a
G.basicUnsafeIndexM Vector (f a)
v Int
i