{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE RankNTypes #-}
#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE DeriveGeneric #-}
#endif
{-# LANGUAGE DeriveDataTypeable #-}
#if defined(__GLASGOW_HASKELL__)
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE ScopedTypeVariables #-}
#endif

#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
#if __GLASGOW_HASKELL__ >= 708
import Data.Coerce
#endif
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
#if (MIN_VERSION_hashable(1,2,5))
import Data.Hashable.Lifted
#endif
import Data.IntMap (IntMap)
import Data.Ix
import Data.Map (Map)
#if !(MIN_VERSION_base(4,8,0))
import Data.Monoid (Monoid(..))
#endif
#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
#if __GLASGOW_HASKELL__ >= 702
import GHC.Generics (Generic)
#endif
#if __GLASGOW_HASKELL__ >= 706
import GHC.Generics (Generic1)
#endif
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

-- | 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 :: * -> *

  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 p a -> Diff p a -> p a
forall (p :: * -> *) a. (Affine p, Num a) => p a -> Diff p a -> p a
.+^ Diff p a -> Diff 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 .-. :: Product f g a -> Product f g a -> Diff (Product f g) a
.-. Pair f a
c g a
d = Diff f a -> Diff g a -> Product (Diff f) (Diff g) a
forall k (f :: k -> *) (g :: k -> *) (a :: k).
f a -> g a -> Product f g a
Pair (f a
a f a -> f a -> Diff f a
forall (p :: * -> *) a. (Affine p, Num a) => p a -> p a -> Diff p a
.-. f a
c) (g a
b g a -> g a -> Diff g a
forall (p :: * -> *) a. (Affine p, Num a) => p a -> p a -> Diff p a
.-. g a
d)
  Pair f a
a g a
b .+^ :: Product f g a -> Diff (Product f g) a -> Product f g a
.+^ Pair c d = f a -> g a -> Product f g a
forall k (f :: k -> *) (g :: k -> *) (a :: k).
f a -> g a -> Product f g a
Pair (f a
a f a -> Diff f a -> f a
forall (p :: * -> *) a. (Affine p, Num a) => p a -> Diff p a -> p a
.+^ Diff f a
c) (g a
b g a -> Diff g a -> g a
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 .-^ :: Product f g a -> Diff (Product f g) a -> Product f g a
.-^ Pair c d = f a -> g a -> Product f g a
forall k (f :: k -> *) (g :: k -> *) (a :: k).
f a -> g a -> Product f g a
Pair (f a
a f a -> Diff f a -> f a
forall (p :: * -> *) a. (Affine p, Num a) => p a -> Diff p a -> p a
.+^ Diff f a
c) (g a
b g a -> Diff g a -> g a
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 :: p a -> p a -> a
qdA p a
a p a
b = Diff p a -> a
forall (t :: * -> *) a. (Foldable t, Num a) => t a -> a
Foldable.sum ((a -> a) -> Diff p a -> Diff p a
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((a -> a -> a) -> a -> a
forall (m :: * -> *) a. Bind m => m (m a) -> m a
join a -> a -> a
forall a. Num a => a -> a -> a
(*)) (p a
a p a -> p a -> Diff p 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 :: p a -> p a -> a
distanceA p a
a p a
b = a -> a
forall a. Floating a => a -> a
sqrt (p a -> p a -> a
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
(Point f a -> Point f a -> Bool)
-> (Point f a -> Point f a -> Bool) -> Eq (Point f a)
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, Eq (Point f a)
Eq (Point f a)
-> (Point f a -> Point f a -> Ordering)
-> (Point f a -> Point f a -> Bool)
-> (Point f a -> Point f a -> Bool)
-> (Point f a -> Point f a -> Bool)
-> (Point f a -> Point f a -> Bool)
-> (Point f a -> Point f a -> Point f a)
-> (Point f a -> Point f a -> Point f a)
-> Ord (Point f a)
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
$cp1Ord :: forall (f :: * -> *) a. Ord (f a) => Eq (Point f a)
Ord, Int -> Point f a -> ShowS
[Point f a] -> ShowS
Point f a -> String
(Int -> Point f a -> ShowS)
-> (Point f a -> String)
-> ([Point f a] -> ShowS)
-> Show (Point f a)
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)
Int -> ReadS (Point f a)
ReadS [Point f a]
(Int -> ReadS (Point f a))
-> ReadS [Point f a]
-> ReadPrec (Point f a)
-> ReadPrec [Point f a]
-> Read (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, Applicative (Point f)
a -> Point f a
Applicative (Point f)
-> (forall a b. Point f a -> (a -> Point f b) -> Point f b)
-> (forall a b. Point f a -> Point f b -> Point f b)
-> (forall a. a -> Point f a)
-> Monad (Point f)
Point f a -> (a -> Point f b) -> Point f b
Point f a -> Point f b -> Point f b
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 :: a -> Point f a
$creturn :: forall (f :: * -> *) a. Monad f => a -> Point f a
>> :: 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
>>= :: 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
$cp1Monad :: forall (f :: * -> *). Monad f => Applicative (Point f)
Monad, a -> Point f b -> Point f a
(a -> b) -> Point f a -> Point f b
(forall a b. (a -> b) -> Point f a -> Point f b)
-> (forall a b. a -> Point f b -> Point f a) -> Functor (Point f)
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
<$ :: a -> Point f b -> Point f a
$c<$ :: forall (f :: * -> *) a b. Functor f => a -> Point f b -> Point f a
fmap :: (a -> b) -> Point f a -> Point f b
$cfmap :: forall (f :: * -> *) a b.
Functor f =>
(a -> b) -> Point f a -> Point f b
Functor, Functor (Point f)
a -> Point f a
Functor (Point f)
-> (forall a. a -> Point f a)
-> (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 a b. Point f a -> Point f b -> Point f b)
-> (forall a b. Point f a -> Point f b -> Point f a)
-> Applicative (Point f)
Point f a -> Point f b -> Point f b
Point f a -> Point f b -> Point f a
Point f (a -> b) -> Point f a -> Point f b
(a -> b -> c) -> Point f a -> Point f b -> Point f c
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
<* :: 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
*> :: 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 :: (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
<*> :: 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 :: a -> Point f a
$cpure :: forall (f :: * -> *) a. Applicative f => a -> Point f a
$cp1Applicative :: forall (f :: * -> *). Applicative f => Functor (Point f)
Applicative, a -> Point f a -> Bool
Point f m -> m
Point f a -> [a]
Point f a -> Bool
Point f a -> Int
Point f a -> a
Point f a -> a
Point f a -> a
Point f a -> a
(a -> m) -> Point f a -> m
(a -> m) -> Point f a -> m
(a -> b -> b) -> b -> Point f a -> b
(a -> b -> b) -> b -> Point f a -> b
(b -> a -> b) -> b -> Point f a -> b
(b -> a -> b) -> b -> Point f a -> b
(a -> a -> a) -> Point f a -> a
(a -> a -> a) -> Point f a -> a
(forall m. Monoid m => Point f m -> m)
-> (forall m a. Monoid m => (a -> m) -> Point f a -> m)
-> (forall m a. Monoid m => (a -> m) -> Point f a -> m)
-> (forall a b. (a -> b -> b) -> b -> Point f a -> b)
-> (forall a b. (a -> b -> b) -> b -> Point f a -> b)
-> (forall b a. (b -> a -> b) -> b -> Point f a -> b)
-> (forall b a. (b -> a -> b) -> b -> Point f a -> b)
-> (forall a. (a -> a -> a) -> Point f a -> a)
-> (forall a. (a -> a -> a) -> Point f a -> a)
-> (forall a. Point f a -> [a])
-> (forall a. Point f a -> Bool)
-> (forall a. Point f a -> Int)
-> (forall a. Eq a => a -> Point f a -> Bool)
-> (forall a. Ord a => Point f a -> a)
-> (forall a. Ord a => Point f a -> a)
-> (forall a. Num a => Point f a -> a)
-> (forall a. Num a => Point f a -> a)
-> Foldable (Point f)
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 :: Point f a -> a
$cproduct :: forall (f :: * -> *) a. (Foldable f, Num a) => Point f a -> a
sum :: Point f a -> a
$csum :: forall (f :: * -> *) a. (Foldable f, Num a) => Point f a -> a
minimum :: Point f a -> a
$cminimum :: forall (f :: * -> *) a. (Foldable f, Ord a) => Point f a -> a
maximum :: Point f a -> a
$cmaximum :: forall (f :: * -> *) a. (Foldable f, Ord a) => Point f a -> a
elem :: a -> Point f a -> Bool
$celem :: forall (f :: * -> *) a.
(Foldable f, Eq a) =>
a -> Point f a -> Bool
length :: Point f a -> Int
$clength :: forall (f :: * -> *) a. Foldable f => Point f a -> Int
null :: Point f a -> Bool
$cnull :: forall (f :: * -> *) a. Foldable f => Point f a -> Bool
toList :: Point f a -> [a]
$ctoList :: forall (f :: * -> *) a. Foldable f => Point f a -> [a]
foldl1 :: (a -> a -> a) -> Point f a -> a
$cfoldl1 :: forall (f :: * -> *) a.
Foldable f =>
(a -> a -> a) -> Point f a -> a
foldr1 :: (a -> a -> a) -> Point f a -> a
$cfoldr1 :: forall (f :: * -> *) a.
Foldable f =>
(a -> a -> a) -> Point f a -> a
foldl' :: (b -> a -> b) -> b -> Point f a -> b
$cfoldl' :: forall (f :: * -> *) b a.
Foldable f =>
(b -> a -> b) -> b -> Point f a -> b
foldl :: (b -> a -> b) -> b -> Point f a -> b
$cfoldl :: forall (f :: * -> *) b a.
Foldable f =>
(b -> a -> b) -> b -> Point f a -> b
foldr' :: (a -> b -> b) -> b -> Point f a -> b
$cfoldr' :: forall (f :: * -> *) a b.
Foldable f =>
(a -> b -> b) -> b -> Point f a -> b
foldr :: (a -> b -> b) -> b -> Point f a -> b
$cfoldr :: forall (f :: * -> *) a b.
Foldable f =>
(a -> b -> b) -> b -> Point f a -> b
foldMap' :: (a -> m) -> Point f a -> m
$cfoldMap' :: forall (f :: * -> *) m a.
(Foldable f, Monoid m) =>
(a -> m) -> Point f a -> m
foldMap :: (a -> m) -> Point f a -> m
$cfoldMap :: forall (f :: * -> *) m a.
(Foldable f, Monoid m) =>
(a -> m) -> Point f a -> m
fold :: Point f m -> m
$cfold :: forall (f :: * -> *) m. (Foldable f, Monoid m) => Point f m -> m
Foldable
           , (a -> b -> Bool) -> Point f a -> Point f b -> Bool
(forall a b. (a -> b -> Bool) -> Point f a -> Point f b -> Bool)
-> Eq1 (Point f)
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 :: (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, Eq1 (Point f)
Eq1 (Point f)
-> (forall a b.
    (a -> b -> Ordering) -> Point f a -> Point f b -> Ordering)
-> Ord1 (Point f)
(a -> b -> Ordering) -> Point f a -> Point f b -> Ordering
forall a b.
(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
forall (f :: * -> *). Ord1 f => Eq1 (Point f)
forall (f :: * -> *) a b.
Ord1 f =>
(a -> b -> Ordering) -> Point f a -> Point f b -> Ordering
liftCompare :: (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
$cp1Ord1 :: forall (f :: * -> *). Ord1 f => Eq1 (Point f)
Ord1, (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Point f a -> ShowS
(Int -> a -> ShowS) -> ([a] -> ShowS) -> [Point f a] -> ShowS
(forall a.
 (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Point f a -> ShowS)
-> (forall a.
    (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Point f a] -> ShowS)
-> Show1 (Point f)
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 :: (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 :: (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, ReadPrec a -> ReadPrec [a] -> ReadPrec (Point f a)
ReadPrec a -> ReadPrec [a] -> ReadPrec [Point f a]
(Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Point f a)
(Int -> ReadS a) -> ReadS [a] -> ReadS [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 a. ReadPrec a -> ReadPrec [a] -> ReadPrec (Point f a))
-> (forall a. ReadPrec a -> ReadPrec [a] -> ReadPrec [Point f a])
-> Read1 (Point f)
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 :: ReadPrec a -> ReadPrec [a] -> ReadPrec [Point f a]
$cliftReadListPrec :: forall (f :: * -> *) a.
Read1 f =>
ReadPrec a -> ReadPrec [a] -> ReadPrec [Point f a]
liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (Point f a)
$cliftReadPrec :: forall (f :: * -> *) a.
Read1 f =>
ReadPrec a -> ReadPrec [a] -> ReadPrec (Point f a)
liftReadList :: (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 :: (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
           , Functor (Point f)
Foldable (Point f)
Functor (Point f)
-> Foldable (Point f)
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> Point f a -> f (Point f b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    Point f (f a) -> f (Point f a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> Point f a -> m (Point f b))
-> (forall (m :: * -> *) a.
    Monad m =>
    Point f (m a) -> m (Point f a))
-> Traversable (Point f)
(a -> f b) -> Point f a -> f (Point f b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (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 (m :: * -> *) a. Monad m => Point f (m a) -> m (Point f a)
forall (f :: * -> *) a.
Applicative f =>
Point f (f a) -> f (Point f a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> Point f a -> m (Point f b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> Point f a -> f (Point f b)
sequence :: 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 :: (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 :: 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 :: (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)
$cp2Traversable :: forall (f :: * -> *). Traversable f => Foldable (Point f)
$cp1Traversable :: forall (f :: * -> *). Traversable f => Functor (Point f)
Traversable, Functor (Point f)
Functor (Point f)
-> (forall a b. Point f (a -> b) -> Point f a -> Point f b)
-> (forall a b. Point f a -> Point f b -> Point f b)
-> (forall a b. Point f a -> Point f b -> Point f a)
-> (forall a b c.
    (a -> b -> c) -> Point f a -> Point f b -> Point f c)
-> Apply (Point f)
Point f a -> Point f b -> Point f b
Point f a -> Point f b -> Point f a
Point f (a -> b) -> Point f a -> Point f b
(a -> b -> c) -> Point f a -> Point f b -> Point f c
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 :: (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
<. :: 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
.> :: 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
<.> :: 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
$cp1Apply :: forall (f :: * -> *). Apply f => Functor (Point f)
Apply, Functor (Point f)
Point f a
a -> Point f a -> Point f a -> Point f a
Functor (Point f)
-> (forall a. Num a => Point f a)
-> (forall a. Num 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. Num a => 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)
-> Additive (Point f)
Point f a -> Point f a -> Point f a
Point f a -> Point f a -> Point f a
(a -> a -> a) -> Point f a -> Point f a -> Point f a
(a -> b -> c) -> Point f a -> Point f b -> Point f c
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 :: (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 :: (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 :: 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
^-^ :: 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
^+^ :: 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 :: Point f a
$czero :: forall (f :: * -> *) a. (Additive f, Num a) => Point f a
$cp1Additive :: forall (f :: * -> *). Additive f => Functor (Point f)
Additive, Additive (Point f)
Additive (Point f)
-> (forall a. Num 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 a. Floating a => Point f a -> Point f a -> a)
-> (forall a. Floating a => Point f a -> a)
-> (forall a. Floating a => Point f a -> Point f a)
-> Metric (Point f)
Point f a -> Point f a -> a
Point f a -> a
Point f a -> Point f a -> a
Point f a -> Point f a -> a
Point f a -> a
Point f a -> Point f a
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 :: Point f a -> Point f a
$csignorm :: forall (f :: * -> *) a.
(Metric f, Floating a) =>
Point f a -> Point f a
norm :: Point f a -> a
$cnorm :: forall (f :: * -> *) a. (Metric f, Floating a) => Point f a -> a
distance :: Point f a -> Point f a -> a
$cdistance :: forall (f :: * -> *) a.
(Metric f, Floating a) =>
Point f a -> Point f a -> a
qd :: Point f a -> Point f a -> a
$cqd :: forall (f :: * -> *) a.
(Metric f, Num a) =>
Point f a -> Point f a -> a
quadrance :: Point f a -> a
$cquadrance :: forall (f :: * -> *) a. (Metric f, Num a) => Point f a -> a
dot :: Point f a -> Point f a -> a
$cdot :: forall (f :: * -> *) a.
(Metric f, Num a) =>
Point f a -> Point f a -> a
$cp1Metric :: forall (f :: * -> *). Metric f => Additive (Point f)
Metric
           , Num (Point f a)
Num (Point f a)
-> (Point f a -> Point f a -> Point f a)
-> (Point f a -> Point f a)
-> (Rational -> Point f a)
-> Fractional (Point f a)
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
$cp1Fractional :: forall (f :: * -> *) a. Fractional (f a) => Num (Point f a)
Fractional , Integer -> Point f a
Point f a -> Point f a
Point f a -> Point f a -> Point f a
(Point f a -> Point f a -> Point f a)
-> (Point f a -> Point f a -> Point f a)
-> (Point f a -> Point f a -> Point f a)
-> (Point f a -> Point f a)
-> (Point f a -> Point f a)
-> (Point f a -> Point f a)
-> (Integer -> Point f a)
-> Num (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, Ord (Point f a)
Ord (Point f a)
-> ((Point f a, Point f a) -> [Point f a])
-> ((Point f a, Point f a) -> Point f a -> Int)
-> ((Point f a, Point f a) -> Point f a -> Int)
-> ((Point f a, Point f a) -> Point f a -> Bool)
-> ((Point f a, Point f a) -> Int)
-> ((Point f a, Point f a) -> Int)
-> Ix (Point f a)
(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]
$cp1Ix :: forall (f :: * -> *) a. Ix (f a) => Ord (Point f a)
Ix, Ptr b -> Int -> IO (Point f a)
Ptr b -> Int -> Point f a -> IO ()
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
(Point f a -> Int)
-> (Point f a -> Int)
-> (Ptr (Point f a) -> Int -> IO (Point f a))
-> (Ptr (Point f a) -> Int -> Point f a -> IO ())
-> (forall b. Ptr b -> Int -> IO (Point f a))
-> (forall b. Ptr b -> Int -> Point f a -> IO ())
-> (Ptr (Point f a) -> IO (Point f a))
-> (Ptr (Point f a) -> Point f a -> IO ())
-> Storable (Point f a)
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 :: Ptr b -> Int -> Point f a -> IO ()
$cpokeByteOff :: forall (f :: * -> *) a b.
Storable (f a) =>
Ptr b -> Int -> Point f a -> IO ()
peekByteOff :: 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, Num (Point f a)
Num (Point f a) -> (Point f a -> Bool) -> Epsilon (Point f a)
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
$cp1Epsilon :: forall (f :: * -> *) a. Epsilon (f a) => Num (Point f a)
Epsilon
           , b -> Point f a -> Point f a
NonEmpty (Point f a) -> Point f a
Point f a -> Point f a -> Point f a
(Point f a -> Point f a -> Point f a)
-> (NonEmpty (Point f a) -> Point f a)
-> (forall b. Integral b => b -> Point f a -> Point f a)
-> Semigroup (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 :: 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, Semigroup (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] -> Point f a)
-> Monoid (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
$cp1Monoid :: forall (f :: * -> *) a. Monoid (f a) => Semigroup (Point f a)
Monoid
           , g -> (Point f a, g)
g -> [Point f a]
(Point f a, Point f a) -> g -> (Point f a, 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 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 => g -> [Point f a])
-> Random (Point f a)
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 :: g -> [Point f a]
$crandoms :: forall (f :: * -> *) a g.
(Random (f a), RandomGen g) =>
g -> [Point f a]
randomRs :: (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 :: g -> (Point f a, g)
$crandom :: forall (f :: * -> *) a g.
(Random (f a), RandomGen g) =>
g -> (Point f a, g)
randomR :: (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
(Int -> Point f a -> Int)
-> (Point f a -> Int) -> Hashable (Point f a)
forall a. (Int -> a -> Int) -> (a -> Int) -> Hashable 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
#if __GLASGOW_HASKELL__ >= 702
           , (forall x. Point f a -> Rep (Point f a) x)
-> (forall x. Rep (Point f a) x -> Point f a)
-> Generic (Point f a)
forall x. Rep (Point f a) x -> Point f a
forall x. Point f a -> Rep (Point f a) x
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
#endif
#if __GLASGOW_HASKELL__ >= 706
           , (forall a. Point f a -> Rep1 (Point f) a)
-> (forall a. Rep1 (Point f) a -> Point f a) -> Generic1 (Point f)
forall a. Rep1 (Point f) a -> Point f a
forall a. Point f a -> Rep1 (Point f) a
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
#endif
#if __GLASGOW_HASKELL__ >= 708
           , Typeable, Typeable (Point f a)
DataType
Constr
Typeable (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 (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c (Point f a))
-> (Point f a -> Constr)
-> (Point f a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c (Point f a)))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e))
    -> Maybe (c (Point f a)))
-> ((forall b. Data b => b -> b) -> Point f a -> Point f a)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> Point f a -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> Point f a -> r)
-> (forall u. (forall d. Data d => d -> u) -> Point f a -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> Point f a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> Point f a -> m (Point f a))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Point f a -> m (Point f a))
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> Point f a -> m (Point f a))
-> Data (Point f a)
Point f a -> DataType
Point f a -> Constr
(forall b. Data b => b -> b) -> Point f a -> Point 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 b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c (Point f a)
forall a.
Typeable a
-> (forall (c :: * -> *).
    (forall d b. Data d => c (d -> b) -> d -> c b)
    -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> Point f a -> u
forall u. (forall d. Data d => d -> u) -> Point f a -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> Point f a -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> Point f a -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> Point f a -> m (Point f a)
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> Point f a -> m (Point f 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))
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c (Point f a))
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e))
-> Maybe (c (Point f a))
$cP :: Constr
$tPoint :: DataType
gmapMo :: (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 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 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 :: 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 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 :: (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 :: (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 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 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 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 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)
$cp1Data :: forall (f :: * -> *) a.
(Typeable f, Typeable a, Data (f a)) =>
Typeable (Point f a)
Data
#endif
           )

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

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

instance Serial1 f => Serial1 (Point f) where
  serializeWith :: (a -> m ()) -> Point f a -> m ()
serializeWith a -> m ()
f (P f a
p) = (a -> m ()) -> f a -> m ()
forall (f :: * -> *) (m :: * -> *) a.
(Serial1 f, MonadPut m) =>
(a -> m ()) -> f a -> m ()
serializeWith a -> m ()
f f a
p
  deserializeWith :: m a -> m (Point f a)
deserializeWith m a
m = f a -> Point f a
forall (f :: * -> *) a. f a -> Point f a
P (f a -> Point f a) -> m (f a) -> m (Point f a)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
`liftM` m a -> m (f a)
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 :: Point f a -> m ()
serialize (P f a
p) = f a -> m ()
forall a (m :: * -> *). (Serial a, MonadPut m) => a -> m ()
serialize f a
p
  deserialize :: m (Point f a)
deserialize = f a -> Point f a
forall (f :: * -> *) a. f a -> Point f a
P (f a -> Point f a) -> m (f a) -> m (Point f a)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
`liftM` m (f a)
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) = f a -> Put
forall t. Binary t => t -> Put
Binary.put f a
p
  get :: Get (Point f a)
get = f a -> Point f a
forall (f :: * -> *) a. f a -> Point f a
P (f a -> Point f a) -> Get (f a) -> Get (Point f a)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
`liftM` Get (f a)
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) = Putter (f a)
forall t. Serialize t => Putter t
Cereal.put f a
p
  get :: Get (Point f a)
get = f a -> Point f a
forall (f :: * -> *) a. f a -> Point f a
P (f a -> Point f a) -> Get (f a) -> Get (Point f a)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
`liftM` Get (f a)
forall t. Serialize t => Get t
Cereal.get

#if (MIN_VERSION_hashable(1,2,5))
instance Hashable1 f => Hashable1 (Point f) where
  liftHashWithSalt :: (Int -> a -> Int) -> Int -> Point f a -> Int
liftHashWithSalt Int -> a -> Int
h Int
s (P f a
f) = (Int -> a -> Int) -> Int -> f a -> Int
forall (t :: * -> *) a.
Hashable1 t =>
(Int -> a -> Int) -> Int -> t a -> Int
liftHashWithSalt Int -> a -> Int
h Int
s f a
f
  {-# INLINE liftHashWithSalt #-}
#endif

#if __GLASGOW_HASKELL__ < 708
instance forall f. Typeable1 f => Typeable1 (Point f) where
  typeOf1 _ = mkTyConApp (mkTyCon3 "linear" "Linear.Affine" "Point") [] `mkAppTy`
              typeOf1 (undefined :: f a)

deriving instance (Data (f a), Typeable1 f, Typeable a) => Data (Point f a)
#endif

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

_Point :: Iso' (Point f a) (f a)
_Point :: p (f a) (f (f a)) -> p (Point f a) (f (Point f a))
_Point = (Point f a -> f a)
-> (f a -> Point f a) -> Iso (Point f a) (Point f a) (f a) (f a)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (\(P f a
a) -> f a
a) f a -> Point f 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' :: p (Unwrapped (Point f a)) (f (Unwrapped (Point f a)))
-> p (Point f a) (f (Point f a))
_Wrapped' = p (Unwrapped (Point f a)) (f (Unwrapped (Point f a)))
-> p (Point f a) (f (Point f a))
forall (f :: * -> *) a. Iso' (Point f a) (f a)
_Point
  {-# INLINE _Wrapped' #-}

#if __GLASGOW_HASKELL__ >= 708
-- These are stolen from Data.Profunctor.Unsafe
(.#) :: Coercible b a => (b -> c) -> (a -> b) -> a -> c
b -> c
f .# :: (b -> c) -> (a -> b) -> a -> c
.# a -> b
_ = (b -> c) -> a -> c
coerce b -> c
f
{-# INLINE (.#) #-}

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

unP :: Point f a -> f a
unP :: 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
#if __GLASGOW_HASKELL__ >= 708
  >>- :: Point f a -> (a -> Point f b) -> Point f b
(>>-) = ((f b -> Point f b
forall (f :: * -> *) a. f a -> Point f a
P (f b -> Point f b)
-> ((a -> Point f b) -> f b) -> (a -> Point f b) -> Point f b
forall b c a. (b -> c) -> (a -> b) -> a -> c
.) (((a -> Point f b) -> f b) -> (a -> Point f b) -> Point f b)
-> (((a -> f b) -> f b) -> (a -> Point f b) -> f b)
-> ((a -> f b) -> f b)
-> (a -> Point f b)
-> Point f b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (((a -> f b) -> f b)
-> ((a -> Point f b) -> a -> f b) -> (a -> Point f b) -> f b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Point f b -> f b
forall (f :: * -> *) a. Point f a -> f a
unP (Point f b -> f b) -> (a -> Point f b) -> a -> f b
forall b c a. (b -> c) -> (a -> b) -> a -> c
.))) (((a -> f b) -> f b) -> (a -> Point f b) -> Point f b)
-> (f a -> (a -> f b) -> f b)
-> f a
-> (a -> Point f b)
-> Point f b
forall c b a. Coercible c b => (b -> c) -> (a -> b) -> a -> c
#. f a -> (a -> f b) -> f b
forall (m :: * -> *) a b. Bind m => m a -> (a -> m b) -> m b
(>>-) (f a -> (a -> Point f b) -> Point f b)
-> (Point f a -> f a) -> Point f a -> (a -> Point f b) -> Point f b
forall b a c. Coercible b a => (b -> c) -> (a -> b) -> a -> c
.# Point f a -> f a
forall (f :: * -> *) a. Point f a -> f a
unP
#else
  P m >>- f = P $ m >>- unP . f
#endif
  join :: Point f (Point f a) -> Point f a
join (P f (Point f a)
m) = f a -> Point f a
forall (f :: * -> *) a. f a -> Point f a
P (f a -> Point f a) -> f a -> Point f a
forall a b. (a -> b) -> a -> b
$ f (Point f a)
m f (Point f a) -> (Point f a -> f a) -> f a
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 :: f (Point f a) -> Point f (f a)
distribute = f (f a) -> Point f (f a)
forall (f :: * -> *) a. f a -> Point f a
P (f (f a) -> Point f (f a))
-> (f (Point f a) -> f (f a)) -> f (Point f a) -> Point f (f a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Point f a -> f a) -> f (Point f a) -> f (f a)
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 :: (a -> Point f b) -> f a -> Point f (f b)
collect = (f (f b) -> Point f (f b)
forall (f :: * -> *) a. f a -> Point f a
P (f (f b) -> Point f (f b))
-> (f a -> f (f b)) -> f a -> Point f (f b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
.) ((f a -> f (f b)) -> f a -> Point f (f b))
-> ((a -> f b) -> f a -> f (f b))
-> (a -> f b)
-> f a
-> Point f (f b)
forall c b a. Coercible c b => (b -> c) -> (a -> b) -> a -> c
#. (a -> f b) -> f a -> f (f b)
forall (g :: * -> *) (f :: * -> *) a b.
(Distributive g, Functor f) =>
(a -> g b) -> f a -> g (f b)
collect ((a -> f b) -> f a -> Point f (f b))
-> ((a -> Point f b) -> a -> f b)
-> (a -> Point f b)
-> f a
-> Point f (f b)
forall b a c. Coercible b a => (b -> c) -> (a -> b) -> a -> c
.# (Point f b -> f b
forall (f :: * -> *) a. Point f a -> f a
unP (Point f b -> f b) -> (a -> Point f b) -> a -> f b
forall b c a. (b -> c) -> (a -> b) -> a -> c
.)

instance Representable f => Representable (Point f) where
  type Rep (Point f) = Rep f
  tabulate :: (Rep (Point f) -> a) -> Point f a
tabulate = f a -> Point f a
forall (f :: * -> *) a. f a -> Point f a
P (f a -> Point f a)
-> ((Rep f -> a) -> f a) -> (Rep f -> a) -> Point f a
forall c b a. Coercible c b => (b -> c) -> (a -> b) -> a -> c
#. (Rep f -> a) -> f a
forall (f :: * -> *) a. Representable f => (Rep f -> a) -> f a
tabulate
  {-# INLINE tabulate #-}
  index :: Point f a -> Rep (Point f) -> a
index = f a -> Rep f -> a
forall (f :: * -> *) a. Representable f => f a -> Rep f -> a
Rep.index (f a -> Rep f -> a)
-> (Point f a -> f a) -> Point f a -> Rep f -> a
forall b a c. Coercible b a => (b -> c) -> (a -> b) -> a -> c
.# Point f a -> f a
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 = (f a -> f (f a)) -> Point f a -> f (Point f a)
forall (g :: * -> *) a. Lens' (Point g a) (g a)
lensP ((f a -> f (f a)) -> Point f a -> f (Point f a))
-> ((IxValue (f a) -> f (IxValue (f a))) -> f a -> f (f a))
-> (IxValue (f a) -> f (IxValue (f a)))
-> Point f a
-> f (Point f a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Index (f a) -> Traversal' (f a) (IxValue (f a))
forall m. Ixed m => Index m -> Traversal' m (IxValue m)
ix Index (f a)
Index (Point f a)
l
  {-# INLINE ix #-}

instance Traversable f => Each (Point f a) (Point f b) a b where
  each :: (a -> f b) -> Point f a -> f (Point f b)
each = (a -> f b) -> Point f a -> f (Point f b)
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 :: (a -> f a) -> Point f a -> f (Point f a)
_x = (f a -> f (f a)) -> Point f a -> f (Point f a)
forall (g :: * -> *) a. Lens' (Point g a) (g a)
lensP ((f a -> f (f a)) -> Point f a -> f (Point f a))
-> ((a -> f a) -> f a -> f (f a))
-> (a -> f a)
-> Point f a
-> f (Point f a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> f a) -> f a -> f (f a)
forall (t :: * -> *) a. R1 t => Lens' (t a) a
_x
  {-# INLINE _x #-}

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

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

instance R4 f => R4 (Point f) where
  _w :: (a -> f a) -> Point f a -> f (Point f a)
_w = (f a -> f (f a)) -> Point f a -> f (Point f a)
forall (g :: * -> *) a. Lens' (Point g a) (g a)
lensP ((f a -> f (f a)) -> Point f a -> f (Point f a))
-> ((a -> f a) -> f a -> f (f a))
-> (a -> f a)
-> Point f a
-> f (Point f a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> f a) -> f a -> f (f a)
forall (t :: * -> *) a. R4 t => Lens' (t a) a
_w
  {-# INLINE _w #-}
  _xyzw :: (V4 a -> f (V4 a)) -> Point f a -> f (Point f a)
_xyzw = (f a -> f (f a)) -> Point f a -> f (Point f a)
forall (g :: * -> *) a. Lens' (Point g a) (g a)
lensP ((f a -> f (f a)) -> Point f a -> f (Point f a))
-> ((V4 a -> f (V4 a)) -> f a -> f (f a))
-> (V4 a -> f (V4 a))
-> Point f a
-> f (Point f a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (V4 a -> f (V4 a)) -> f a -> f (f a)
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
  .-. :: Point f a -> Point f a -> Diff (Point f) a
(.-.) = ((f a -> f a) -> (Point f a -> f a) -> Point f a -> f a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Point f a -> f a
forall (f :: * -> *) a. Point f a -> f a
unP) ((f a -> f a) -> Point f a -> f a)
-> (f a -> f a -> f a) -> f a -> Point f a -> f a
forall c b a. Coercible c b => (b -> c) -> (a -> b) -> a -> c
#. f a -> f a -> f a
forall (f :: * -> *) a. (Additive f, Num a) => f a -> f a -> f a
(^-^) (f a -> Point f a -> f a)
-> (Point f a -> f a) -> Point f a -> Point f a -> f a
forall b a c. Coercible b a => (b -> c) -> (a -> b) -> a -> c
.# Point f a -> f a
forall (f :: * -> *) a. Point f a -> f a
unP
  {-# INLINE (.-.) #-}
  .+^ :: Point f a -> Diff (Point f) a -> Point f a
(.+^) = (f a -> Point f a
forall (f :: * -> *) a. f a -> Point f a
P (f a -> Point f a) -> (f a -> f a) -> f a -> Point f a
forall b c a. (b -> c) -> (a -> b) -> a -> c
.) ((f a -> f a) -> f a -> Point f a)
-> (f a -> f a -> f a) -> f a -> f a -> Point f a
forall c b a. Coercible c b => (b -> c) -> (a -> b) -> a -> c
#. f a -> f a -> f a
forall (f :: * -> *) a. (Additive f, Num a) => f a -> f a -> f a
(^+^) (f a -> f a -> Point f a)
-> (Point f a -> f a) -> Point f a -> f a -> Point f a
forall b a c. Coercible b a => (b -> c) -> (a -> b) -> a -> c
.# Point f a -> f a
forall (f :: * -> *) a. Point f a -> f a
unP
  {-# INLINE (.+^) #-}
  .-^ :: Point f a -> Diff (Point f) a -> Point f a
(.-^) = (f a -> Point f a
forall (f :: * -> *) a. f a -> Point f a
P (f a -> Point f a) -> (f a -> f a) -> f a -> Point f a
forall b c a. (b -> c) -> (a -> b) -> a -> c
.) ((f a -> f a) -> f a -> Point f a)
-> (f a -> f a -> f a) -> f a -> f a -> Point f a
forall c b a. Coercible c b => (b -> c) -> (a -> b) -> a -> c
#. f a -> f a -> f a
forall (f :: * -> *) a. (Additive f, Num a) => f a -> f a -> f a
(^-^) (f a -> f a -> Point f a)
-> (Point f a -> f a) -> Point f a -> f a -> Point f a
forall b a c. Coercible b a => (b -> c) -> (a -> b) -> a -> c
.# Point f a -> f a
forall (f :: * -> *) a. Point f a -> f a
unP
  {-# INLINE (.-^) #-}

-- | Vector spaces have origins.
origin :: (Additive f, Num a) => Point f a
origin :: Point f a
origin = f a -> Point f a
forall (f :: * -> *) a. f a -> Point f a
P f a
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 :: Point f a -> Iso' (Point f a) (f a)
relative Point f a
p0 = (Point f a -> f a) -> (f a -> Point f a) -> Iso' (Point f a) (f a)
forall s a b t. (s -> a) -> (b -> t) -> Iso s t a b
iso (Point f a -> Point f a -> Diff (Point f) a
forall (p :: * -> *) a. (Affine p, Num a) => p a -> p a -> Diff p a
.-. Point f a
p0) (Point f a
p0 Point f a -> Diff (Point f) a -> Point f a
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 :: MVector s (Point f a) -> Int
basicLength (MV_P v) = MVector s (f a) -> Int
forall (v :: * -> * -> *) a s. MVector v a => v s a -> Int
M.basicLength MVector s (f a)
v
  basicUnsafeSlice :: Int -> Int -> MVector s (Point f a) -> MVector s (Point f a)
basicUnsafeSlice Int
m Int
n (MV_P v) = MVector s (f a) -> MVector s (Point f a)
forall s (f :: * -> *) a. MVector s (f a) -> MVector s (Point f a)
MV_P (Int -> Int -> MVector s (f a) -> MVector s (f a)
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 :: MVector s (Point f a) -> MVector s (Point f a) -> Bool
basicOverlaps (MV_P v) (MV_P u) = MVector s (f a) -> MVector s (f a) -> Bool
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 :: Int -> m (MVector (PrimState m) (Point f a))
basicUnsafeNew Int
n = MVector (PrimState m) (f a) -> MVector (PrimState m) (Point f a)
forall s (f :: * -> *) a. MVector s (f a) -> MVector s (Point f a)
MV_P (MVector (PrimState m) (f a) -> MVector (PrimState m) (Point f a))
-> m (MVector (PrimState m) (f a))
-> m (MVector (PrimState m) (Point f a))
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
`liftM` Int -> m (MVector (PrimState m) (f a))
forall (v :: * -> * -> *) a (m :: * -> *).
(MVector v a, PrimMonad m) =>
Int -> m (v (PrimState m) a)
M.basicUnsafeNew Int
n
  basicUnsafeRead :: MVector (PrimState m) (Point f a) -> Int -> m (Point f a)
basicUnsafeRead (MV_P v) Int
i = f a -> Point f a
forall (f :: * -> *) a. f a -> Point f a
P (f a -> Point f a) -> m (f a) -> m (Point f a)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
`liftM` MVector (PrimState m) (f a) -> Int -> m (f a)
forall (v :: * -> * -> *) a (m :: * -> *).
(MVector v a, PrimMonad m) =>
v (PrimState m) a -> Int -> m a
M.basicUnsafeRead MVector (PrimState m) (f a)
v Int
i
  basicUnsafeWrite :: MVector (PrimState m) (Point f a) -> Int -> Point f a -> m ()
basicUnsafeWrite (MV_P v) Int
i (P f a
x) = MVector (PrimState m) (f a) -> Int -> f a -> m ()
forall (v :: * -> * -> *) a (m :: * -> *).
(MVector v a, PrimMonad m) =>
v (PrimState m) a -> Int -> a -> m ()
M.basicUnsafeWrite MVector (PrimState m) (f a)
v Int
i f a
x
#if MIN_VERSION_vector(0,11,0)
  basicInitialize :: MVector (PrimState m) (Point f a) -> m ()
basicInitialize (MV_P v) = MVector (PrimState m) (f a) -> m ()
forall (v :: * -> * -> *) a (m :: * -> *).
(MVector v a, PrimMonad m) =>
v (PrimState m) a -> m ()
M.basicInitialize MVector (PrimState m) (f a)
v
  {-# INLINE basicInitialize #-}
#endif

instance U.Unbox (f a) => G.Vector U.Vector (Point f a) where
  {-# INLINE basicUnsafeFreeze #-}
  {-# INLINE basicUnsafeThaw   #-}
  {-# INLINE basicLength       #-}
  {-# INLINE basicUnsafeSlice  #-}
  {-# INLINE basicUnsafeIndexM #-}
  basicUnsafeFreeze :: Mutable Vector (PrimState m) (Point f a) -> m (Vector (Point f a))
basicUnsafeFreeze (MV_P v) = Vector (f a) -> Vector (Point f a)
forall (f :: * -> *) a. Vector (f a) -> Vector (Point f a)
V_P (Vector (f a) -> Vector (Point f a))
-> m (Vector (f a)) -> m (Vector (Point f a))
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
`liftM` Mutable Vector (PrimState m) (f a) -> m (Vector (f a))
forall (v :: * -> *) a (m :: * -> *).
(Vector v a, PrimMonad m) =>
Mutable v (PrimState m) a -> m (v a)
G.basicUnsafeFreeze MVector (PrimState m) (f a)
Mutable Vector (PrimState m) (f a)
v
  basicUnsafeThaw :: Vector (Point f a) -> m (Mutable Vector (PrimState m) (Point f a))
basicUnsafeThaw   ( V_P v) = MVector (PrimState m) (f a) -> MVector (PrimState m) (Point f a)
forall s (f :: * -> *) a. MVector s (f a) -> MVector s (Point f a)
MV_P (MVector (PrimState m) (f a) -> MVector (PrimState m) (Point f a))
-> m (MVector (PrimState m) (f a))
-> m (MVector (PrimState m) (Point f a))
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
`liftM` Vector (f a) -> m (Mutable Vector (PrimState m) (f a))
forall (v :: * -> *) a (m :: * -> *).
(Vector v a, PrimMonad m) =>
v a -> m (Mutable v (PrimState m) a)
G.basicUnsafeThaw   Vector (f a)
v
  basicLength :: Vector (Point f a) -> Int
basicLength       ( V_P v) = Vector (f a) -> Int
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 v) = Vector (f a) -> Vector (Point f a)
forall (f :: * -> *) a. Vector (f a) -> Vector (Point f a)
V_P (Int -> Int -> Vector (f a) -> Vector (f a)
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 -> m (Point f a)
basicUnsafeIndexM (V_P v) Int
i = f a -> Point f a
forall (f :: * -> *) a. f a -> Point f a
P (f a -> Point f a) -> m (f a) -> m (Point f a)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
`liftM` Vector (f a) -> Int -> m (f a)
forall (v :: * -> *) a (m :: * -> *).
(Vector v a, Monad m) =>
v a -> Int -> m a
G.basicUnsafeIndexM Vector (f a)
v Int
i