packages feed

linear 1.20.4 → 1.20.5

raw patch · 15 files changed

+223/−21 lines, 15 filesdep ~binarydep ~directorydep ~doctestPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: binary, directory, doctest, semigroupoids, transformers, transformers-compat, vector

API changes (from Hackage documentation)

- Linear.Affine: instance (Data.Data.Data (f a), Data.Typeable.Internal.Typeable f, Data.Typeable.Internal.Typeable a) => Data.Data.Data (Linear.Affine.Point f a)
- Linear.Affine: instance (t ~ Linear.Affine.Point g b) => Control.Lens.Wrapped.Rewrapped (Linear.Affine.Point f a) t
- Linear.Affine: instance GHC.Generics.Constructor Linear.Affine.C1_0Point
- Linear.Affine: instance GHC.Generics.Datatype Linear.Affine.D1Point
- Linear.Plucker: instance GHC.Generics.Constructor Linear.Plucker.C1_0LinePass
- Linear.Plucker: instance GHC.Generics.Constructor Linear.Plucker.C1_0Plucker
- Linear.Plucker: instance GHC.Generics.Constructor Linear.Plucker.C1_1LinePass
- Linear.Plucker: instance GHC.Generics.Constructor Linear.Plucker.C1_2LinePass
- Linear.Plucker: instance GHC.Generics.Datatype Linear.Plucker.D1LinePass
- Linear.Plucker: instance GHC.Generics.Datatype Linear.Plucker.D1Plucker
- Linear.Plucker.Coincides: Line :: Plucker a -> Coincides a
- Linear.Plucker.Coincides: Ray :: Plucker a -> Coincides a
- Linear.Quaternion: _e :: Complicated t => Lens' (t a) a
- Linear.Quaternion: _i :: Complicated t => Lens' (t a) a
- Linear.Quaternion: _j :: Hamiltonian t => Lens' (t a) a
- Linear.Quaternion: _k :: Hamiltonian t => Lens' (t a) a
- Linear.Quaternion: instance GHC.Generics.Constructor Linear.Quaternion.C1_0Quaternion
- Linear.Quaternion: instance GHC.Generics.Datatype Linear.Quaternion.D1Quaternion
- Linear.V: instance GHC.Generics.Constructor Linear.V.C1_0V
- Linear.V: instance GHC.Generics.Datatype Linear.V.D1V
- Linear.V: instance GHC.Generics.Selector Linear.V.S1_0_0V
- Linear.V: instance forall (k :: BOX) (n :: k) a b. Control.Lens.Each.Each (Linear.V.V n a) (Linear.V.V n b) a b
- Linear.V: instance forall (k :: BOX) (n :: k) a. (Data.Typeable.Internal.Typeable (Linear.V.V n), Data.Typeable.Internal.Typeable (Linear.V.V n a), Linear.V.Dim n, Data.Data.Data a) => Data.Data.Data (Linear.V.V n a)
- Linear.V: instance forall (k :: BOX) (n :: k) a. (GHC.Enum.Bounded a, Linear.V.Dim n) => GHC.Enum.Bounded (Linear.V.V n a)
- Linear.V: instance forall (k :: BOX) (n :: k) a. (Linear.V.Dim n, Data.Binary.Class.Binary a) => Data.Binary.Class.Binary (Linear.V.V n a)
- Linear.V: instance forall (k :: BOX) (n :: k) a. (Linear.V.Dim n, Data.Bytes.Serial.Serial a) => Data.Bytes.Serial.Serial (Linear.V.V n a)
- Linear.V: instance forall (k :: BOX) (n :: k) a. (Linear.V.Dim n, Data.Serialize.Serialize a) => Data.Serialize.Serialize (Linear.V.V n a)
- Linear.V: instance forall (k :: BOX) (n :: k) a. (Linear.V.Dim n, Data.Vector.Unboxed.Base.Unbox a) => Data.Vector.Generic.Base.Vector Data.Vector.Unboxed.Base.Vector (Linear.V.V n a)
- Linear.V: instance forall (k :: BOX) (n :: k) a. (Linear.V.Dim n, Data.Vector.Unboxed.Base.Unbox a) => Data.Vector.Generic.Mutable.Base.MVector Data.Vector.Unboxed.Base.MVector (Linear.V.V n a)
- Linear.V: instance forall (k :: BOX) (n :: k) a. (Linear.V.Dim n, Data.Vector.Unboxed.Base.Unbox a) => Data.Vector.Unboxed.Base.Unbox (Linear.V.V n a)
- Linear.V: instance forall (k :: BOX) (n :: k) a. (Linear.V.Dim n, Foreign.Storable.Storable a) => Foreign.Storable.Storable (Linear.V.V n a)
- Linear.V: instance forall (k :: BOX) (n :: k) a. (Linear.V.Dim n, GHC.Float.Floating a) => GHC.Float.Floating (Linear.V.V n a)
- Linear.V: instance forall (k :: BOX) (n :: k) a. (Linear.V.Dim n, GHC.Num.Num a) => GHC.Num.Num (Linear.V.V n a)
- Linear.V: instance forall (k :: BOX) (n :: k) a. (Linear.V.Dim n, GHC.Real.Fractional a) => GHC.Real.Fractional (Linear.V.V n a)
- Linear.V: instance forall (k :: BOX) (n :: k) a. (Linear.V.Dim n, Linear.Epsilon.Epsilon a) => Linear.Epsilon.Epsilon (Linear.V.V n a)
- Linear.V: instance forall (k :: BOX) (n :: k) a. Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Linear.V.V n a)
- Linear.V: instance forall (k :: BOX) (n :: k) a. Control.Lens.At.Ixed (Linear.V.V n a)
- Linear.V: instance forall (k :: BOX) (n :: k) a. GHC.Classes.Eq a => GHC.Classes.Eq (Linear.V.V n a)
- Linear.V: instance forall (k :: BOX) (n :: k) a. GHC.Classes.Ord a => GHC.Classes.Ord (Linear.V.V n a)
- Linear.V: instance forall (k :: BOX) (n :: k) a. GHC.Generics.Generic (Linear.V.V n a)
- Linear.V: instance forall (k :: BOX) (n :: k) a. GHC.Read.Read a => GHC.Read.Read (Linear.V.V n a)
- Linear.V: instance forall (k :: BOX) (n :: k) a. GHC.Show.Show a => GHC.Show.Show (Linear.V.V n a)
- Linear.V: instance forall (k :: BOX) (n :: k) a. Linear.V.Dim n => Linear.V.Dim (Linear.V.V n a)
- Linear.V: instance forall (k :: BOX) (n :: k). Control.Lens.Indexed.FoldableWithIndex GHC.Types.Int (Linear.V.V n)
- Linear.V: instance forall (k :: BOX) (n :: k). Control.Lens.Indexed.FunctorWithIndex GHC.Types.Int (Linear.V.V n)
- Linear.V: instance forall (k :: BOX) (n :: k). Control.Lens.Indexed.TraversableWithIndex GHC.Types.Int (Linear.V.V n)
- Linear.V: instance forall (k :: BOX) (n :: k). Data.Foldable.Foldable (Linear.V.V n)
- Linear.V: instance forall (k :: BOX) (n :: k). Data.Functor.Bind.Class.Apply (Linear.V.V n)
- Linear.V: instance forall (k :: BOX) (n :: k). Data.Functor.Bind.Class.Bind (Linear.V.V n)
- Linear.V: instance forall (k :: BOX) (n :: k). Data.Traversable.Traversable (Linear.V.V n)
- Linear.V: instance forall (k :: BOX) (n :: k). GHC.Base.Functor (Linear.V.V n)
- Linear.V: instance forall (k :: BOX) (n :: k). GHC.Generics.Generic1 (Linear.V.V n)
- Linear.V: instance forall (k :: BOX) (n :: k). Linear.V.Dim n => Control.Monad.Fix.MonadFix (Linear.V.V n)
- Linear.V: instance forall (k :: BOX) (n :: k). Linear.V.Dim n => Control.Monad.Zip.MonadZip (Linear.V.V n)
- Linear.V: instance forall (k :: BOX) (n :: k). Linear.V.Dim n => Data.Bytes.Serial.Serial1 (Linear.V.V n)
- Linear.V: instance forall (k :: BOX) (n :: k). Linear.V.Dim n => Data.Distributive.Distributive (Linear.V.V n)
- Linear.V: instance forall (k :: BOX) (n :: k). Linear.V.Dim n => Data.Functor.Classes.Eq1 (Linear.V.V n)
- Linear.V: instance forall (k :: BOX) (n :: k). Linear.V.Dim n => Data.Functor.Classes.Ord1 (Linear.V.V n)
- Linear.V: instance forall (k :: BOX) (n :: k). Linear.V.Dim n => Data.Functor.Classes.Read1 (Linear.V.V n)
- Linear.V: instance forall (k :: BOX) (n :: k). Linear.V.Dim n => Data.Functor.Classes.Show1 (Linear.V.V n)
- Linear.V: instance forall (k :: BOX) (n :: k). Linear.V.Dim n => Data.Functor.Rep.Representable (Linear.V.V n)
- Linear.V: instance forall (k :: BOX) (n :: k). Linear.V.Dim n => GHC.Base.Applicative (Linear.V.V n)
- Linear.V: instance forall (k :: BOX) (n :: k). Linear.V.Dim n => GHC.Base.Monad (Linear.V.V n)
- Linear.V: instance forall (k :: BOX) (n :: k). Linear.V.Dim n => Linear.Metric.Metric (Linear.V.V n)
- Linear.V: instance forall (k :: BOX) (n :: k). Linear.V.Dim n => Linear.Vector.Additive (Linear.V.V n)
- Linear.V0: instance Foreign.Storable.Storable a => Foreign.Storable.Storable (Linear.V0.V0 a)
- Linear.V0: instance GHC.Generics.Constructor Linear.V0.C1_0V0
- Linear.V0: instance GHC.Generics.Datatype Linear.V0.D1V0
- Linear.V0: instance Linear.Epsilon.Epsilon a => Linear.Epsilon.Epsilon (Linear.V0.V0 a)
- Linear.V1: instance GHC.Generics.Constructor Linear.V1.C1_0V1
- Linear.V1: instance GHC.Generics.Datatype Linear.V1.D1V1
- Linear.V2: instance GHC.Generics.Constructor Linear.V2.C1_0V2
- Linear.V2: instance GHC.Generics.Datatype Linear.V2.D1V2
- Linear.V3: instance GHC.Generics.Constructor Linear.V3.C1_0V3
- Linear.V3: instance GHC.Generics.Datatype Linear.V3.D1V3
- Linear.V4: instance GHC.Generics.Constructor Linear.V4.C1_0V4
- Linear.V4: instance GHC.Generics.Datatype Linear.V4.D1V4
+ Linear.Affine: instance (Data.Data.Data (f a), Data.Typeable.Internal.Typeable a, Data.Typeable.Internal.Typeable f) => Data.Data.Data (Linear.Affine.Point f a)
+ Linear.Affine: instance t ~ Linear.Affine.Point g b => Control.Lens.Wrapped.Rewrapped (Linear.Affine.Point f a) t
+ Linear.Affine: type family Diff p :: * -> *;
+ Linear.Affine: }
+ Linear.Covector: infixr 0 $*
+ Linear.Matrix: infixl 6 !-!
+ Linear.Matrix: infixl 7 !!/
+ Linear.Plucker: infixl 5 ><
+ Linear.Plucker.Coincides: [Line] :: (Epsilon a, Fractional a) => Plucker a -> Coincides a
+ Linear.Plucker.Coincides: [Ray] :: (Epsilon a, Fractional a, Ord a) => Plucker a -> Coincides a
+ Linear.Quaternion: _e, _i :: Complicated t => Lens' (t a) a
+ Linear.Quaternion: _j, _k :: Hamiltonian t => Lens' (t a) a
+ Linear.V: instance forall k (n :: k) a b. Control.Lens.Each.Each (Linear.V.V n a) (Linear.V.V n b) a b
+ Linear.V: instance forall k (n :: k) a. (Data.Typeable.Internal.Typeable (Linear.V.V n), Data.Typeable.Internal.Typeable (Linear.V.V n a), Linear.V.Dim n, Data.Data.Data a) => Data.Data.Data (Linear.V.V n a)
+ Linear.V: instance forall k (n :: k) a. (Linear.V.Dim n, Data.Binary.Class.Binary a) => Data.Binary.Class.Binary (Linear.V.V n a)
+ Linear.V: instance forall k (n :: k) a. (Linear.V.Dim n, Data.Bytes.Serial.Serial a) => Data.Bytes.Serial.Serial (Linear.V.V n a)
+ Linear.V: instance forall k (n :: k) a. (Linear.V.Dim n, Data.Serialize.Serialize a) => Data.Serialize.Serialize (Linear.V.V n a)
+ Linear.V: instance forall k (n :: k) a. (Linear.V.Dim n, Data.Vector.Unboxed.Base.Unbox a) => Data.Vector.Generic.Base.Vector Data.Vector.Unboxed.Base.Vector (Linear.V.V n a)
+ Linear.V: instance forall k (n :: k) a. (Linear.V.Dim n, Data.Vector.Unboxed.Base.Unbox a) => Data.Vector.Generic.Mutable.Base.MVector Data.Vector.Unboxed.Base.MVector (Linear.V.V n a)
+ Linear.V: instance forall k (n :: k) a. (Linear.V.Dim n, Data.Vector.Unboxed.Base.Unbox a) => Data.Vector.Unboxed.Base.Unbox (Linear.V.V n a)
+ Linear.V: instance forall k (n :: k) a. (Linear.V.Dim n, Foreign.Storable.Storable a) => Foreign.Storable.Storable (Linear.V.V n a)
+ Linear.V: instance forall k (n :: k) a. (Linear.V.Dim n, GHC.Float.Floating a) => GHC.Float.Floating (Linear.V.V n a)
+ Linear.V: instance forall k (n :: k) a. (Linear.V.Dim n, GHC.Num.Num a) => GHC.Num.Num (Linear.V.V n a)
+ Linear.V: instance forall k (n :: k) a. (Linear.V.Dim n, GHC.Real.Fractional a) => GHC.Real.Fractional (Linear.V.V n a)
+ Linear.V: instance forall k (n :: k) a. (Linear.V.Dim n, Linear.Epsilon.Epsilon a) => Linear.Epsilon.Epsilon (Linear.V.V n a)
+ Linear.V: instance forall k (n :: k) a. Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Linear.V.V n a)
+ Linear.V: instance forall k (n :: k) a. Control.Lens.At.Ixed (Linear.V.V n a)
+ Linear.V: instance forall k (n :: k) a. GHC.Classes.Eq a => GHC.Classes.Eq (Linear.V.V n a)
+ Linear.V: instance forall k (n :: k) a. GHC.Classes.Ord a => GHC.Classes.Ord (Linear.V.V n a)
+ Linear.V: instance forall k (n :: k) a. GHC.Generics.Generic (Linear.V.V n a)
+ Linear.V: instance forall k (n :: k) a. GHC.Read.Read a => GHC.Read.Read (Linear.V.V n a)
+ Linear.V: instance forall k (n :: k) a. GHC.Show.Show a => GHC.Show.Show (Linear.V.V n a)
+ Linear.V: instance forall k (n :: k) a. Linear.V.Dim n => Linear.V.Dim (Linear.V.V n a)
+ Linear.V: instance forall k (n :: k). Control.Lens.Indexed.FoldableWithIndex GHC.Types.Int (Linear.V.V n)
+ Linear.V: instance forall k (n :: k). Control.Lens.Indexed.FunctorWithIndex GHC.Types.Int (Linear.V.V n)
+ Linear.V: instance forall k (n :: k). Control.Lens.Indexed.TraversableWithIndex GHC.Types.Int (Linear.V.V n)
+ Linear.V: instance forall k (n :: k). Data.Foldable.Foldable (Linear.V.V n)
+ Linear.V: instance forall k (n :: k). Data.Functor.Bind.Class.Apply (Linear.V.V n)
+ Linear.V: instance forall k (n :: k). Data.Functor.Bind.Class.Bind (Linear.V.V n)
+ Linear.V: instance forall k (n :: k). Data.Functor.Classes.Eq1 (Linear.V.V n)
+ Linear.V: instance forall k (n :: k). Data.Functor.Classes.Ord1 (Linear.V.V n)
+ Linear.V: instance forall k (n :: k). Data.Functor.Classes.Show1 (Linear.V.V n)
+ Linear.V: instance forall k (n :: k). Data.Traversable.Traversable (Linear.V.V n)
+ Linear.V: instance forall k (n :: k). GHC.Base.Functor (Linear.V.V n)
+ Linear.V: instance forall k (n :: k). GHC.Generics.Generic1 (Linear.V.V n)
+ Linear.V: instance forall k (n :: k). Linear.V.Dim n => Control.Monad.Fix.MonadFix (Linear.V.V n)
+ Linear.V: instance forall k (n :: k). Linear.V.Dim n => Control.Monad.Zip.MonadZip (Linear.V.V n)
+ Linear.V: instance forall k (n :: k). Linear.V.Dim n => Data.Bytes.Serial.Serial1 (Linear.V.V n)
+ Linear.V: instance forall k (n :: k). Linear.V.Dim n => Data.Distributive.Distributive (Linear.V.V n)
+ Linear.V: instance forall k (n :: k). Linear.V.Dim n => Data.Functor.Classes.Read1 (Linear.V.V n)
+ Linear.V: instance forall k (n :: k). Linear.V.Dim n => Data.Functor.Rep.Representable (Linear.V.V n)
+ Linear.V: instance forall k (n :: k). Linear.V.Dim n => GHC.Base.Applicative (Linear.V.V n)
+ Linear.V: instance forall k (n :: k). Linear.V.Dim n => GHC.Base.Monad (Linear.V.V n)
+ Linear.V: instance forall k (n :: k). Linear.V.Dim n => Linear.Metric.Metric (Linear.V.V n)
+ Linear.V: instance forall k (n :: k). Linear.V.Dim n => Linear.Vector.Additive (Linear.V.V n)
+ Linear.V: instance forall k a (n :: k). (GHC.Enum.Bounded a, Linear.V.Dim n) => GHC.Enum.Bounded (Linear.V.V n a)
+ Linear.V0: instance Foreign.Storable.Storable (Linear.V0.V0 a)
+ Linear.V0: instance Linear.Epsilon.Epsilon (Linear.V0.V0 a)
+ Linear.V2: crossZ :: Num a => V2 a -> V2 a -> a
+ Linear.Vector: infixl 7 ^/
- Linear.Affine: class Additive (Diff p) => Affine p where type family Diff p :: * -> * p .-^ v = p .+^ negated v
+ Linear.Affine: class Additive (Diff p) => Affine p where type Diff p :: * -> * p .-^ v = p .+^ negated v where {
- Linear.Conjugate: conjugate :: Conjugate a => a -> a
+ Linear.Conjugate: conjugate :: (Conjugate a, TrivialConjugate a) => a -> a
- Linear.Matrix: diagonal :: Trace m => m (m a) -> m a
+ Linear.Matrix: diagonal :: (Trace m, Monad m) => m (m a) -> m a
- Linear.Matrix: inv22 :: Floating a => M22 a -> M22 a
+ Linear.Matrix: inv22 :: Fractional a => M22 a -> M22 a
- Linear.Matrix: inv33 :: Floating a => M33 a -> M33 a
+ Linear.Matrix: inv33 :: Fractional a => M33 a -> M33 a
- Linear.Matrix: trace :: (Trace m, Num a) => m (m a) -> a
+ Linear.Matrix: trace :: (Trace m, Foldable m, Num a) => m (m a) -> a
- Linear.Metric: dot :: (Metric f, Num a) => f a -> f a -> a
+ Linear.Metric: dot :: (Metric f, Foldable f, Num a) => f a -> f a -> a
- Linear.Plucker: passes :: (Epsilon a, Num a, Ord a) => Plucker a -> Plucker a -> LinePass
+ Linear.Plucker: passes :: (Epsilon a, Ord a) => Plucker a -> Plucker a -> LinePass
- Linear.Plucker: squaredError :: (Eq a, Num a) => Plucker a -> a
+ Linear.Plucker: squaredError :: Num a => Plucker a -> a
- Linear.Trace: diagonal :: Trace m => m (m a) -> m a
+ Linear.Trace: diagonal :: (Trace m, Monad m) => m (m a) -> m a
- Linear.Trace: trace :: (Trace m, Num a) => m (m a) -> a
+ Linear.Trace: trace :: (Trace m, Foldable m, Num a) => m (m a) -> a
- Linear.V: dim :: Dim n => V n a -> Int
+ Linear.V: dim :: forall n a. Dim n => V n a -> Int
- Linear.V: fromVector :: Dim n => Vector a -> Maybe (V n a)
+ Linear.V: fromVector :: forall n a. Dim n => Vector a -> Maybe (V n a)
- Linear.V: reifyVector :: Vector a -> (forall (n :: *). Dim n => V n a -> r) -> r
+ Linear.V: reifyVector :: forall a r. Vector a -> (forall (n :: *). Dim n => V n a -> r) -> r
- Linear.V: reifyVectorNat :: Vector a -> (forall (n :: Nat). KnownNat n => V n a -> r) -> r
+ Linear.V: reifyVectorNat :: forall a r. Vector a -> (forall (n :: Nat). KnownNat n => V n a -> r) -> r
- Linear.Vector: liftI2 :: Additive f => (a -> b -> c) -> f a -> f b -> f c
+ Linear.Vector: liftI2 :: (Additive f, Applicative f) => (a -> b -> c) -> f a -> f b -> f c
- Linear.Vector: liftU2 :: Additive f => (a -> a -> a) -> f a -> f a -> f a
+ Linear.Vector: liftU2 :: (Additive f, Applicative f) => (a -> a -> a) -> f a -> f a -> f a
- Linear.Vector: zero :: (Additive f, Num a) => f a
+ Linear.Vector: zero :: (Additive f, GAdditive (Rep1 f), Generic1 f, Num a) => f a

Files

.travis.yml view
@@ -1,13 +1,14 @@ env:- - GHCVER=7.4.2 CABALVER=1.16- - GHCVER=7.6.3 CABALVER=1.16+ - GHCVER=7.4.2 CABALVER=1.18+ - GHCVER=7.6.3 CABALVER=1.18  - GHCVER=7.8.4 CABALVER=1.18  - GHCVER=7.10.1 CABALVER=1.22+ - GHCVER=8.0.1 CABALVER=1.24  - GHCVER=head CABALVER=1.22  matrix:   allow_failures:-   - env: GHCVER=head CABALVER=1.22+   - env: GHCVER=head CABALVER=1.24  before_install:  - travis_retry sudo add-apt-repository -y ppa:hvr/ghc
CHANGELOG.markdown view
@@ -1,3 +1,8 @@+1.20.5+------+* GHC 8 compatibility+* Fixed the `perspective` calculation.+ 1.20.4 ------ * Compatibility with `base-orphans` 0.5
linear.cabal view
@@ -1,6 +1,6 @@ name:          linear category:      Math, Algebra-version:       1.20.4+version:       1.20.5 license:       BSD3 cabal-version: >= 1.8 license-file:  LICENSE@@ -13,7 +13,7 @@ synopsis:      Linear Algebra description:   Types and combinators for linear algebra on free vector spaces build-type:    Custom-tested-with:   GHC == 7.4.2, GHC == 7.6.1, GHC == 7.8.4, GHC == 7.10.1+tested-with:   GHC == 7.4.2, GHC == 7.6.1, GHC == 7.8.4, GHC == 7.10.1, GHC==8.0.1 extra-source-files:   .gitignore   .travis.yml@@ -45,7 +45,7 @@     adjunctions          >= 4     && < 5,     base                 >= 4.5   && < 5,     base-orphans         >= 0.5   && < 1,-    binary               >= 0.5   && < 0.8,+    binary               >= 0.5   && < 0.9,     bytes                >= 0.15  && < 1,     cereal               >= 0.4.1.1 && < 0.6,     containers           >= 0.4   && < 0.6,@@ -58,7 +58,7 @@     semigroups           >= 0.9   && < 1,     semigroupoids        >= 3     && < 6,     tagged               >= 0.4.4 && < 1,-    transformers         >= 0.2   && < 0.5,+    transformers         >= 0.2   && < 0.6,     transformers-compat  >= 0.4   && < 1,     unordered-containers >= 0.2.3 && < 0.3,     vector               >= 0.10  && < 0.12,@@ -99,6 +99,10 @@   ghc-options: -Wall -fwarn-tabs -O2 -fdicts-cheap -funbox-strict-fields   hs-source-dirs: src +  -- hack around the buggy unused matches check for class associated types in ghc 8 rc1+  if impl(ghc >= 8)+    ghc-options: -fno-warn-unused-matches+ -- Verify the results of the examples test-suite doctests   type:           exitcode-stdio-1.0@@ -108,7 +112,7 @@   build-depends:     base,     directory >= 1.0 && < 1.3,-    doctest   >= 0.8 && < 0.11,+    doctest   >= 0.8 && < 0.12,     filepath  >= 1.3 && < 1.5,     lens,     simple-reflect >= 0.3.1@@ -127,3 +131,5 @@     test-framework-hunit >= 0.3,     HUnit >= 1.2.5,     linear++
src/Linear/Algebra.hs view
@@ -1,6 +1,10 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-}+#if __GLASGOW_HASKELL__ >= 800+{-# OPTIONS_GHC -fno-warn-redundant-constraints #-} -- they are mathematically required, not redundant, damn it.+#endif ----------------------------------------------------------------------------- -- | -- License     :  BSD-style (see the file LICENSE)
src/Linear/Conjugate.hs view
@@ -1,5 +1,9 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE DefaultSignatures #-}+#if __GLASGOW_HASKELL__ >= 800+{-# OPTIONS_GHC -fno-warn-redundant-constraints #-}+#endif+ ----------------------------------------------------------------------------- -- | -- Copyright   :  (C) 2012-2015 Edward Kmett
src/Linear/Matrix.hs view
@@ -343,7 +343,7 @@ -- -- >>> inv22 $ V2 (V2 1 2) (V2 3 4) -- V2 (V2 (-2.0) 1.0) (V2 1.5 (-0.5))-inv22 :: Floating a => M22 a -> M22 a+inv22 :: Fractional a => M22 a -> M22 a inv22 m@(V2 (V2 a b) (V2 c d)) = (1 / det) *!! V2 (V2 d (-b)) (V2 (-c) a)   where det = det22 m {-# INLINE inv22 #-}@@ -352,7 +352,7 @@ -- -- >>> inv33 $ V3 (V3 1 2 4) (V3 4 2 2) (V3 1 1 1) -- V3 (V3 0.0 0.5 (-1.0)) (V3 (-0.5) (-0.75) 3.5) (V3 0.5 0.25 (-1.5))-inv33 :: Floating a => M33 a -> M33 a+inv33 :: Fractional a => M33 a -> M33 a inv33 m@(V3 (V3 a b c)             (V3 d e f)             (V3 g h i))
src/Linear/Plucker.hs view
@@ -12,6 +12,10 @@ #ifndef MIN_VERSION_vector #define MIN_VERSION_vector(x,y,z) 1 #endif++#ifndef MIN_VERSION_transformers+#define MIN_VERSION_transformers(x,y,z) 1+#endif ----------------------------------------------------------------------------- -- | -- Copyright   :  (C) 2012-2015 Edward Kmett@@ -412,7 +416,7 @@ -- | Valid Plücker coordinates @p@ will have @'squaredError' p '==' 0@ -- -- That said, floating point makes a mockery of this claim, so you may want to use 'nearZero'.-squaredError :: (Eq a, Num a) => Plucker a -> a+squaredError :: Num a => Plucker a -> a squaredError v = v >< v {-# INLINE squaredError #-} @@ -452,7 +456,7 @@  -- | Check how two lines pass each other. @passes l1 l2@ describes -- @l2@ when looking down @l1@.-passes :: (Epsilon a, Num a, Ord a) => Plucker a -> Plucker a -> LinePass+passes :: (Epsilon a, Ord a) => Plucker a -> Plucker a -> LinePass passes a b   | nearZero s = Coplanar   | s > 0 = Counterclockwise@@ -590,7 +594,33 @@   put = serializeWith Cereal.put   get = deserializeWith Cereal.get ++#if (MIN_VERSION_transformers(0,5,0)) || !(MIN_VERSION_transformers(0,4,0))+instance Eq1 Plucker where+  liftEq k (Plucker a1 b1 c1 d1 e1 f1)+           (Plucker a2 b2 c2 d2 e2 f2)+         = k a1 a2 && k b1 b2 && k c1 c2 && k d1 d2 && k e1 e2 && k f1 f2+instance Ord1 Plucker where+  liftCompare k (Plucker a1 b1 c1 d1 e1 f1)+                (Plucker a2 b2 c2 d2 e2 f2)+            = k a1 a2 `mappend` k b1 b2 `mappend` k c1 c2 `mappend` k d1 d2 `mappend` k e1 e2 `mappend` k f1 f2+instance Read1 Plucker where+  liftReadsPrec k _ z = readParen (z > 10) $ \r ->+     [ (Plucker a b c d e f, r7)+     | ("Plucker",r1) <- lex r+     , (a,r2) <- k 11 r1+     , (b,r3) <- k 11 r2+     , (c,r4) <- k 11 r3+     , (d,r5) <- k 11 r4+     , (e,r6) <- k 11 r5+     , (f,r7) <- k 11 r6+     ]+instance Show1 Plucker where+  liftShowsPrec k _ z (Plucker a b c d e f) = showParen (z > 10) $+     showString "Plucker " . k 11 a . showChar ' ' . k 11 b . showChar ' ' . k 11 c . showChar ' ' . k 11 d . showChar ' ' . k 11 e . showChar ' ' . k 11 f+#else instance Eq1 Plucker where eq1 = (==) instance Ord1 Plucker where compare1 = compare instance Show1 Plucker where showsPrec1 = showsPrec instance Read1 Plucker where readsPrec1 = readsPrec+#endif
src/Linear/Projection.hs view
@@ -71,8 +71,8 @@         y = 1 / tanHalfFovy         fpn = far + near         fmn = far - near-        oon = 1/near-        oof = 1/far+        oon = 0.5/near+        oof = 0.5/far         -- z = 1 / (near/fpn - far/fpn) -- would be better by .5 bits         z = -fpn/fmn         w = 1/(oof-oon) -- 13 bits error reduced to 0.17@@ -100,8 +100,8 @@         b = tanHalfFovy         c = oon - oof         d = oon + oof-        oon = 1/near-        oof = 1/far+        oon = 0.5/near+        oof = 0.5/far   -- | Build a perspective matrix per the classic @glFrustum@ arguments.
src/Linear/Quaternion.hs view
@@ -624,7 +624,18 @@   put = serializeWith Cereal.put   get = deserializeWith Cereal.get +#if (MIN_VERSION_transformers(0,5,0)) || !(MIN_VERSION_transformers(0,4,0))+instance Eq1 Quaternion where+  liftEq f (Quaternion a b) (Quaternion c d) = f a c && liftEq f b d+instance Ord1 Quaternion where+  liftCompare f (Quaternion a b) (Quaternion c d) = f a c `mappend` liftCompare f b d+instance Show1 Quaternion where+  liftShowsPrec f g d (Quaternion a b) = showsBinaryWith f (liftShowsPrec f g) "Quaternion" d a b+instance Read1 Quaternion where+  liftReadsPrec f g = readsData $ readsBinaryWith f (liftReadsPrec f g) "Quaternion" Quaternion+#else instance Eq1 Quaternion where eq1 = (==) instance Ord1 Quaternion where compare1 = compare instance Show1 Quaternion where showsPrec1 = showsPrec instance Read1 Quaternion where readsPrec1 = readsPrec+#endif
src/Linear/V.hs view
@@ -20,6 +20,10 @@ #define MIN_VERSION_reflection(x,y,z) 1 #endif +#ifndef MIN_VERSION_transformers+#define MIN_VERSION_transformers(x,y,z) 1+#endif+ ----------------------------------------------------------------------------- -- | -- Copyright   :  (C) 2012-2015 Edward Kmett@@ -93,6 +97,12 @@ import Linear.Epsilon import Linear.Metric import Linear.Vector+#if (MIN_VERSION_transformers(0,5,0)) || !(MIN_VERSION_transformers(0,4,0))+import Prelude as P+#if __GLASGOW_HASKELL__ < 710+import Data.Monoid+#endif+#endif   #ifdef HLINT@@ -462,10 +472,36 @@   put = serializeWith Cereal.put   get = deserializeWith Cereal.get +#if (MIN_VERSION_transformers(0,5,0)) || !(MIN_VERSION_transformers(0,4,0))+instance Eq1 (V n) where+  liftEq f0 (V as0) (V bs0) = go f0 (V.toList as0) (V.toList bs0) where+    go _ [] [] = True+    go f (a:as) (b:bs) = f a b && go f as bs+    go _ _ _ = False++instance Ord1 (V n) where+  liftCompare f0 (V as0) (V bs0) = go f0 (V.toList as0) (V.toList bs0) where+    go f (a:as) (b:bs) = f a b `mappend` go f as bs+    go _ [] [] = EQ+    go _ _  [] = GT+    go _ [] _  = LT++instance Show1 (V n) where+  liftShowsPrec _ g d (V as) = showParen (d > 10) $ showString "V " . g (V.toList as)++instance Dim n => Read1 (V n) where+  liftReadsPrec _ g d = readParen (d > 10) $ \r ->+    [ (V (V.fromList as), r2)+    | ("V",r1) <- lex r+    , (as, r2) <- g r1+    , P.length as == reflectDim (Proxy :: Proxy n)+    ]+#else instance Dim n => Eq1 (V n) where eq1 = (==) instance Dim n => Ord1 (V n) where compare1 = compare instance Dim n => Show1 (V n) where showsPrec1 = showsPrec instance Dim n => Read1 (V n) where readsPrec1 = readsPrec+#endif   data instance U.Vector    (V n a) =  V_VN {-# UNPACK #-} !Int !(U.Vector    a)
src/Linear/V0.hs view
@@ -10,13 +10,18 @@ #endif  #ifndef MIN_VERSION_hashable-#define MIN_VERSION_hashable+#define MIN_VERSION_hashable(x,y,z) 1 #endif  #ifndef MIN_VERSION_vector #define MIN_VERSION_vector(x,y,z) 1 #endif +#ifndef MIN_VERSION_transformers+#define MIN_VERSION_transformers(x,y,z) 1+#endif++ ----------------------------------------------------------------------------- -- | -- Copyright   :  (C) 2012-2015 Edward Kmett@@ -220,11 +225,11 @@   hashWithSalt s V0 = s   {-# INLINE hashWithSalt #-} -instance Epsilon a => Epsilon (V0 a) where+instance Epsilon (V0 a) where   nearZero _ = True   {-# INLINE nearZero #-} -instance Storable a => Storable (V0 a) where+instance Storable (V0 a) where   sizeOf _ = 0   {-# INLINE sizeOf #-}   alignment _ = 1@@ -315,7 +320,18 @@ instance NFData (V0 a) where   rnf V0 = () +#if (MIN_VERSION_transformers(0,5,0)) || !(MIN_VERSION_transformers(0,4,0))+instance Eq1 V0   where+  liftEq _ _ _ = True+instance Ord1 V0  where+  liftCompare _ _ _ = EQ+instance Show1 V0 where+  liftShowsPrec _ _ = showsPrec+instance Read1 V0 where+  liftReadsPrec _ _ = readsPrec+#else instance Eq1 V0   where eq1 = (==) instance Ord1 V0  where compare1 = compare instance Show1 V0 where showsPrec1 = showsPrec instance Read1 V0 where readsPrec1 = readsPrec+#endif
src/Linear/V1.hs view
@@ -21,6 +21,11 @@ #ifndef MIN_VERSION_vector #define MIN_VERSION_vector(x,y,z) 1 #endif++#ifndef MIN_VERSION_transformers+#define MIN_VERSION_transformers(x,y,z) 1+#endif+ ----------------------------------------------------------------------------- -- | -- Copyright   :  (C) 2012-2015 Edward Kmett@@ -348,7 +353,18 @@   put = serializeWith Cereal.put   get = deserializeWith Cereal.get +#if (MIN_VERSION_transformers(0,5,0)) || !(MIN_VERSION_transformers(0,4,0))+instance Eq1 V1 where+  liftEq f (V1 a) (V1 b) = f a b+instance Ord1 V1 where+  liftCompare f (V1 a) (V1 b) = f a b+instance Show1 V1 where+  liftShowsPrec f _ d (V1 a) = showParen (d >= 10) $ showString "V1 " . f d a+instance Read1 V1 where+  liftReadsPrec f _ = readsData $ readsUnaryWith f "V1" V1+#else instance Eq1 V1 where eq1 = (==) instance Ord1 V1 where compare1 = compare instance Show1 V1 where showsPrec1 = showsPrec instance Read1 V1 where readsPrec1 = readsPrec+#endif
src/Linear/V2.hs view
@@ -14,6 +14,12 @@ #ifndef MIN_VERSION_vector #define MIN_VERSION_vector(x,y,z) 1 #endif++#ifndef MIN_VERSION_transformers+#define MIN_VERSION_transformers(x,y,z) 1+#endif++ ----------------------------------------------------------------------------- -- | -- Copyright   :  (C) 2012-2015 Edward Kmett@@ -33,6 +39,7 @@   , ex, ey   , perp   , angle+  , crossZ   ) where  import Control.Applicative@@ -385,6 +392,14 @@ angle :: Floating a => a -> V2 a angle a = V2 (cos a) (sin a) +-- | The Z-component of the cross product of two vectors in the XY-plane.+--+-- >>> crossZ (V2 1 0) (V2 0 1)+-- 1+crossZ :: Num a => V2 a -> V2 a -> a+crossZ (V2 x1 y1) (V2 x2 y2) = x1*y2 - y1*x2+{-# INLINE crossZ #-}+ instance Bounded a => Bounded (V2 a) where   minBound = pure minBound   {-# INLINE minBound #-}@@ -410,7 +425,18 @@   put = serializeWith Cereal.put   get = deserializeWith Cereal.get +#if (MIN_VERSION_transformers(0,5,0)) || !(MIN_VERSION_transformers(0,4,0))+instance Eq1 V2 where+  liftEq f (V2 a b) (V2 c d) = f a c && f b d+instance Ord1 V2 where+  liftCompare f (V2 a b) (V2 c d) = f a c `mappend` f b d+instance Read1 V2 where+  liftReadsPrec f _ = readsData $ readsBinaryWith f f "V2" V2+instance Show1 V2 where+  liftShowsPrec f _ d (V2 a b) = showsBinaryWith f f "V2" d a b+#else instance Eq1 V2 where eq1 = (==) instance Ord1 V2 where compare1 = compare instance Show1 V2 where showsPrec1 = showsPrec instance Read1 V2 where readsPrec1 = readsPrec+#endif
src/Linear/V3.hs view
@@ -14,6 +14,10 @@ #define MIN_VERSION_vector(x,y,z) 1 #endif +#ifndef MIN_VERSION_transformers+#define MIN_VERSION_transformers(x,y,z) 1+#endif+ ----------------------------------------------------------------------------- -- | -- Copyright   :  (C) 2012-2015 Edward Kmett@@ -434,7 +438,25 @@   put = serializeWith Cereal.put   get = deserializeWith Cereal.get +#if (MIN_VERSION_transformers(0,5,0)) || !(MIN_VERSION_transformers(0,4,0))+instance Eq1 V3 where+  liftEq k (V3 a b c) (V3 d e f) = k a d && k b e && k c f+instance Ord1 V3 where+  liftCompare k (V3 a b c) (V3 d e f) = k a d `mappend` k b e `mappend` k c f+instance Read1 V3 where+  liftReadsPrec k _ d = readParen (d > 10) $ \r ->+     [ (V3 a b c, r4)+     | ("V3",r1) <- lex r+     , (a,r2) <- k 11 r1+     , (b,r3) <- k 11 r2+     , (c,r4) <- k 11 r3+     ]+instance Show1 V3 where+  liftShowsPrec f _ d (V3 a b c) = showParen (d > 10) $+     showString "V3 " . f 11 a . showChar ' ' . f 11 b . showChar ' ' . f 11 c+#else instance Eq1 V3 where eq1 = (==) instance Ord1 V3 where compare1 = compare instance Show1 V3 where showsPrec1 = showsPrec instance Read1 V3 where readsPrec1 = readsPrec+#endif
src/Linear/V4.hs view
@@ -13,6 +13,10 @@ #ifndef MIN_VERSION_vector #define MIN_VERSION_vector(x,y,z) 1 #endif++#ifndef MIN_VERSION_transformers+#define MIN_VERSION_transformers(x,y,z) 1+#endif ----------------------------------------------------------------------------- -- | -- Copyright   :  (C) 2012-2015 Edward Kmett@@ -421,12 +425,14 @@     where ptr' = castPtr ptr   {-# INLINE peek #-} --- | Convert a 3-dimensional affine vector into a 4-dimensional homogeneous vector.+-- | Convert a 3-dimensional affine vector into a 4-dimensional homogeneous vector,+-- i.e. sets the @w@ coordinate to 0. vector :: Num a => V3 a -> V4 a vector (V3 a b c) = V4 a b c 0 {-# INLINE vector #-} --- | Convert a 3-dimensional affine point into a 4-dimensional homogeneous vector.+-- | Convert a 3-dimensional affine point into a 4-dimensional homogeneous vector,+-- i.e. sets the @w@ coordinate to 1. point :: Num a => V3 a -> V4 a point (V3 a b c) = V4 a b c 1 {-# INLINE point #-}@@ -568,7 +574,26 @@   put = serializeWith Cereal.put   get = deserializeWith Cereal.get +#if (MIN_VERSION_transformers(0,5,0)) || !(MIN_VERSION_transformers(0,4,0))+instance Eq1 V4 where+  liftEq k (V4 a b c d) (V4 e f g h) = k a e && k b f && k c g && k d h+instance Ord1 V4 where+  liftCompare k (V4 a b c d) (V4 e f g h) = k a e `mappend` k b f `mappend` k c g `mappend` k d h+instance Read1 V4 where+  liftReadsPrec k _ z = readParen (z > 10) $ \r ->+     [ (V4 a b c d, r5)+     | ("V4",r1) <- lex r+     , (a,r2) <- k 11 r1+     , (b,r3) <- k 11 r2+     , (c,r4) <- k 11 r3+     , (d,r5) <- k 11 r4+     ]+instance Show1 V4 where+  liftShowsPrec f _ z (V4 a b c d) = showParen (z > 10) $+     showString "V4 " . f 11 a . showChar ' ' . f 11 b . showChar ' ' . f 11 c . showChar ' ' . f 11 d+#else instance Eq1 V4 where eq1 = (==) instance Ord1 V4 where compare1 = compare instance Show1 V4 where showsPrec1 = showsPrec instance Read1 V4 where readsPrec1 = readsPrec+#endif