linear 1.18.0.1 → 1.18.1
raw patch · 5 files changed
+80/−6 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Linear.Matrix: _m22 :: (Representable t, R2 t, R2 v) => Lens' (t (v a)) (M22 a)
+ Linear.Matrix: _m23 :: (Representable t, R2 t, R3 v) => Lens' (t (v a)) (M23 a)
+ Linear.Matrix: _m24 :: (Representable t, R2 t, R4 v) => Lens' (t (v a)) (M24 a)
+ Linear.Matrix: _m32 :: (Representable t, R3 t, R2 v) => Lens' (t (v a)) (M32 a)
+ Linear.Matrix: _m33 :: (Representable t, R3 t, R3 v) => Lens' (t (v a)) (M33 a)
+ Linear.Matrix: _m34 :: (Representable t, R3 t, R4 v) => Lens' (t (v a)) (M34 a)
+ Linear.Matrix: _m42 :: (Representable t, R4 t, R2 v) => Lens' (t (v a)) (M42 a)
+ Linear.Matrix: _m43 :: (Representable t, R4 t, R3 v) => Lens' (t (v a)) (M43 a)
+ Linear.Matrix: _m44 :: (Representable t, R4 t, R4 v) => Lens' (t (v a)) (M44 a)
Files
- CHANGELOG.markdown +9/−0
- linear.cabal +12/−2
- src/Linear/Matrix.hs +48/−0
- src/Linear/V.hs +4/−2
- src/Linear/V1.hs +7/−2
CHANGELOG.markdown view
@@ -1,3 +1,12 @@+1.18.1+------+* Added an `-f-template-haskell` option to allow disabling `template-haskell` support. This is an unsupported configuration but may be useful for expert users in sandbox configurations.+* Added lenses for extracting corner various sub-matrices e.g. `_m22`, `_m33`++1.18.0.2+--------+* Fixed builds on even older GHCs.+ 1.18.0.1 -------- * Fixed the test suite.
linear.cabal view
@@ -1,6 +1,6 @@ name: linear category: Math, Algebra-version: 1.18.0.1+version: 1.18.1 license: BSD3 cabal-version: >= 1.8 license-file: LICENSE@@ -24,6 +24,14 @@ CHANGELOG.markdown README.markdown +flag template-haskell+ description:+ You can disable the use of the `template-haskell` package using `-f-template-haskell`.+ .+ Disabling this is an unsupported configuration, but it may be useful for accelerating builds in sandboxes for expert users.+ default: True+ manual: True+ source-repository head type: git location: git://github.com/ekmett/linear.git@@ -45,12 +53,14 @@ semigroups >= 0.9 && < 1, semigroupoids >= 3 && < 5, tagged >= 0.4.4 && < 1,- template-haskell >= 2.7 && < 3.0, transformers >= 0.2 && < 0.5, transformers-compat >= 0.4 && < 1, unordered-containers >= 0.2.3 && < 0.3, vector >= 0.10 && < 0.11, void >= 0.6 && < 1++ if flag(template-haskell) && impl(ghc)+ build-depends: template-haskell >= 2.7 && < 3.0 exposed-modules: Linear
src/Linear/Matrix.hs view
@@ -30,6 +30,9 @@ , fromQuaternion , mkTransformation , mkTransformationMat+ , _m22, _m23, _m24+ , _m32, _m33, _m34+ , _m42, _m43, _m44 ) where import Control.Applicative@@ -243,6 +246,51 @@ -- translation = (. fmap (^._w)) . _xyz where -- x ^. l = getConst (l Const x) -}++-- |Extract a 2x2 matrix from a matrix of higher dimensions by dropping excess+-- rows and columns.+_m22 :: (Representable t, R2 t, R2 v) => Lens' (t (v a)) (M22 a)+_m22 = column _xy._xy++-- |Extract a 2x3 matrix from a matrix of higher dimensions by dropping excess+-- rows and columns.+_m23 :: (Representable t, R2 t, R3 v) => Lens' (t (v a)) (M23 a)+_m23 = column _xyz._xy++-- |Extract a 2x4 matrix from a matrix of higher dimensions by dropping excess+-- rows and columns.+_m24 :: (Representable t, R2 t, R4 v) => Lens' (t (v a)) (M24 a)+_m24 = column _xyzw._xy++-- |Extract a 3x2 matrix from a matrix of higher dimensions by dropping excess+-- rows and columns.+_m32 :: (Representable t, R3 t, R2 v) => Lens' (t (v a)) (M32 a)+_m32 = column _xy._xyz++-- |Extract a 3x3 matrix from a matrix of higher dimensions by dropping excess+-- rows and columns.+_m33 :: (Representable t, R3 t, R3 v) => Lens' (t (v a)) (M33 a)+_m33 = column _xyz._xyz++-- |Extract a 3x4 matrix from a matrix of higher dimensions by dropping excess+-- rows and columns.+_m34 :: (Representable t, R3 t, R4 v) => Lens' (t (v a)) (M34 a)+_m34 = column _xyzw._xyz++-- |Extract a 4x2 matrix from a matrix of higher dimensions by dropping excess+-- rows and columns.+_m42 :: (Representable t, R4 t, R2 v) => Lens' (t (v a)) (M42 a)+_m42 = column _xy._xyzw++-- |Extract a 4x3 matrix from a matrix of higher dimensions by dropping excess+-- rows and columns.+_m43 :: (Representable t, R4 t, R3 v) => Lens' (t (v a)) (M43 a)+_m43 = column _xyz._xyzw++-- |Extract a 4x4 matrix from a matrix of higher dimensions by dropping excess+-- rows and columns.+_m44 :: (Representable t, R4 t, R4 v) => Lens' (t (v a)) (M44 a)+_m44 = column _xyzw._xyzw -- |2x2 matrix determinant. --
src/Linear/V.hs view
@@ -34,7 +34,9 @@ module Linear.V ( V(V,toVector)+#ifdef MIN_VERSION_template_haskell , int+#endif , dim , Dim(..) , reifyDim@@ -73,7 +75,7 @@ #if __GLASGOW_HASKELL__ >= 707 import GHC.Generics (Generic1) #endif-#if !(MIN_VERSION_reflection(1,3,0))+#if !(MIN_VERSION_reflection(1,3,0)) && defined(MIN_VERSION_template_haskell) import Language.Haskell.TH #endif import Linear.Epsilon@@ -283,7 +285,7 @@ | V.length v == reflectDim (Proxy :: Proxy n) = Just (V v) | otherwise = Nothing -#if !(MIN_VERSION_reflection(1,3,0))+#if !(MIN_VERSION_reflection(1,3,0)) && defined(MIN_VERSION_template_haskell) data Z -- 0 data D (n :: *) -- 2n data SD (n :: *) -- 2n+1
src/Linear/V1.hs view
@@ -313,8 +313,13 @@ maxBound = pure maxBound {-# INLINE maxBound #-} -instance Serial1 V1-instance Serial a => Serial (V1 a)+instance Serial1 V1 where+ serializeWith f (V1 a) = f a+ deserializeWith m = V1 `liftM` m++instance Serial a => Serial (V1 a) where+ serialize (V1 a) = serialize a+ deserialize = V1 `liftM` deserialize instance Binary a => Binary (V1 a) where put = serializeWith Binary.put