linear 1.15.2 → 1.15.3
raw patch · 4 files changed
+22/−1 lines, 4 files
Files
- CHANGELOG.markdown +4/−0
- linear.cabal +1/−1
- src/Linear/Projection.hs +5/−0
- src/Linear/V.hs +12/−0
CHANGELOG.markdown view
@@ -1,3 +1,7 @@+1.15.3+------+* Added missing `FunctorWithIndex`, `FoldableWithIndex` and `TraversableWithIndex Int (V n)` instances for `V`+ 1.15.2 ------ * Added `frustum`, analogous to the old `glFrustum` call.
linear.cabal view
@@ -1,6 +1,6 @@ name: linear category: Math, Algebra-version: 1.15.2+version: 1.15.3 license: BSD3 cabal-version: >= 1.8 license-file: LICENSE
src/Linear/Projection.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} --------------------------------------------------------------------------- -- | -- Copyright : (C) 2014 Edward Kmett@@ -28,6 +29,10 @@ import Linear.Matrix import Linear.Epsilon import Linear.Metric++#ifdef HLINT+{-# ANN module "HLint: ignore Reduce duplication" #-}+#endif -- | Build a look at view matrix lookAt
src/Linear/V.hs view
@@ -126,13 +126,25 @@ fmap f (V as) = V (fmap f as) {-# INLINE fmap #-} +instance FunctorWithIndex Int (V n) where+ imap f (V as) = V (Lens.imap f as)+ {-# INLINE imap #-}+ instance Foldable (V n) where foldMap f (V as) = foldMap f as {-# INLINE foldMap #-} +instance FoldableWithIndex Int (V n) where+ ifoldMap f (V as) = ifoldMap f as+ {-# INLINE ifoldMap #-}+ instance Traversable (V n) where traverse f (V as) = V <$> traverse f as {-# INLINE traverse #-}++instance TraversableWithIndex Int (V n) where+ itraverse f (V as) = V <$> itraverse f as+ {-# INLINE itraverse #-} instance Apply (V n) where V as <.> V bs = V (V.zipWith id as bs)