linear 1.21.3 → 1.21.4
raw patch · 25 files changed
+86/−334 lines, 25 filesdep −doctestdep ~lensdep ~vectorsetup-changed
Dependencies removed: doctest
Dependency ranges changed: lens, vector
Files
- .hlint.yaml +4/−0
- .travis.yml +0/−164
- CHANGELOG.markdown +8/−0
- README.markdown +1/−1
- Setup.lhs +5/−32
- Warning.hs +0/−5
- linear.cabal +15/−24
- src/Linear.hs +0/−2
- src/Linear/Affine.hs +0/−4
- src/Linear/Conjugate.hs +4/−0
- src/Linear/Matrix.hs +8/−11
- src/Linear/Plucker.hs +0/−2
- src/Linear/Projection.hs +4/−3
- src/Linear/Quaternion.hs +0/−2
- src/Linear/Trace.hs +1/−0
- src/Linear/V.hs +13/−17
- src/Linear/V0.hs +3/−0
- src/Linear/V1.hs +3/−5
- src/Linear/V2.hs +3/−0
- src/Linear/V3.hs +2/−1
- src/Linear/V4.hs +2/−1
- src/Linear/Vector.hs +5/−6
- tests/doctests.hs +5/−11
- travis/cabal-apt-install +0/−27
- travis/config +0/−16
+ .hlint.yaml view
@@ -0,0 +1,4 @@+- ignore: {name: Use fmap}+- ignore: {name: Avoid lambda}+- ignore: {name: Redundant lambda}+- ignore: {name: Unused LANGUAGE pragma}
− .travis.yml
@@ -1,164 +0,0 @@-# This Travis job script has been generated by a script via-#-# haskell-ci '--output=.travis.yml' '--config=cabal.haskell-ci' 'cabal.project'-#-# To regenerate the script (for example after adjusting tested-with) run-#-# haskell-ci regenerate-#-# For more information, see https://github.com/haskell-CI/haskell-ci-#-# version: 0.10-#-version: ~> 1.0-language: c-os: linux-dist: xenial-git:- # whether to recursively clone submodules- submodules: false-notifications:- irc:- channels:- - irc.freenode.org#haskell-lens- skip_join: true- template:- - "\x0313linear\x03/\x0306%{branch}\x03 \x0314%{commit}\x03 %{build_url} %{message}"-cache:- directories:- - $HOME/.cabal/packages- - $HOME/.cabal/store- - $HOME/.hlint-before_cache:- - rm -fv $CABALHOME/packages/hackage.haskell.org/build-reports.log- # remove files that are regenerated by 'cabal update'- - rm -fv $CABALHOME/packages/hackage.haskell.org/00-index.*- - rm -fv $CABALHOME/packages/hackage.haskell.org/*.json- - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.cache- - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar- - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar.idx- - rm -rfv $CABALHOME/packages/head.hackage-jobs:- include:- - compiler: ghc-8.10.1- addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.10.1","cabal-install-3.2"]}}- os: linux- - compiler: ghc-8.8.3- addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.8.3","cabal-install-3.2"]}}- os: linux- - compiler: ghc-8.6.5- addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.6.5","cabal-install-3.2"]}}- os: linux- - compiler: ghc-8.4.4- addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.4.4","cabal-install-3.2"]}}- os: linux- - compiler: ghc-8.2.2- addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.2.2","cabal-install-3.2"]}}- os: linux- - compiler: ghc-8.0.2- addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.0.2","cabal-install-3.2"]}}- os: linux- - compiler: ghc-7.10.3- addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-7.10.3","cabal-install-3.2"]}}- os: linux- - compiler: ghc-7.8.4- addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-7.8.4","cabal-install-3.2"]}}- os: linux- - compiler: ghc-7.6.3- addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-7.6.3","cabal-install-3.2"]}}- os: linux- - compiler: ghc-7.4.2- addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-7.4.2","cabal-install-3.2"]}}- os: linux-before_install:- - HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//')- - WITHCOMPILER="-w $HC"- - HADDOCK=$(echo "/opt/$CC/bin/haddock" | sed 's/-/\//')- - HCPKG="$HC-pkg"- - unset CC- - CABAL=/opt/ghc/bin/cabal- - CABALHOME=$HOME/.cabal- - export PATH="$CABALHOME/bin:$PATH"- - TOP=$(pwd)- - "HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\\d+)\\.(\\d+)\\.(\\d+)(\\.(\\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')"- - echo $HCNUMVER- - CABAL="$CABAL -vnormal+nowrap"- - set -o pipefail- - TEST=--enable-tests- - BENCH=--enable-benchmarks- - HEADHACKAGE=false- - rm -f $CABALHOME/config- - |- echo "verbose: normal +nowrap +markoutput" >> $CABALHOME/config- echo "remote-build-reporting: anonymous" >> $CABALHOME/config- echo "write-ghc-environment-files: always" >> $CABALHOME/config- echo "remote-repo-cache: $CABALHOME/packages" >> $CABALHOME/config- echo "logs-dir: $CABALHOME/logs" >> $CABALHOME/config- echo "world-file: $CABALHOME/world" >> $CABALHOME/config- echo "extra-prog-path: $CABALHOME/bin" >> $CABALHOME/config- echo "symlink-bindir: $CABALHOME/bin" >> $CABALHOME/config- echo "installdir: $CABALHOME/bin" >> $CABALHOME/config- echo "build-summary: $CABALHOME/logs/build.log" >> $CABALHOME/config- echo "store-dir: $CABALHOME/store" >> $CABALHOME/config- echo "install-dirs user" >> $CABALHOME/config- echo " prefix: $CABALHOME" >> $CABALHOME/config- echo "repository hackage.haskell.org" >> $CABALHOME/config- echo " url: http://hackage.haskell.org/" >> $CABALHOME/config-install:- - ${CABAL} --version- - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"- - |- echo "program-default-options" >> $CABALHOME/config- echo " ghc-options: $GHCJOBS +RTS -M6G -RTS" >> $CABALHOME/config- - cat $CABALHOME/config- - rm -fv cabal.project cabal.project.local cabal.project.freeze- - travis_retry ${CABAL} v2-update -v- # Generate cabal.project- - rm -rf cabal.project cabal.project.local cabal.project.freeze- - touch cabal.project- - |- echo "packages: ." >> cabal.project- - if [ $HCNUMVER -ge 80200 ] ; then echo 'package linear' >> cabal.project ; fi- - "if [ $HCNUMVER -ge 80200 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi"- - |- - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(linear)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"- - cat cabal.project || true- - cat cabal.project.local || true- - if [ -f "./configure.ac" ]; then (cd "." && autoreconf -i); fi- - ${CABAL} v2-freeze $WITHCOMPILER ${TEST} ${BENCH}- - "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'"- - rm cabal.project.freeze- - travis_wait 40 ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} --dep -j2 all-script:- - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)- # Packaging...- - ${CABAL} v2-sdist all- # Unpacking...- - mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/- - cd ${DISTDIR} || false- - find . -maxdepth 1 -type f -name '*.tar.gz' -exec tar -xvf '{}' \;- - find . -maxdepth 1 -type f -name '*.tar.gz' -exec rm '{}' \;- - PKGDIR_linear="$(find . -maxdepth 1 -type d -regex '.*/linear-[0-9.]*')"- # Generate cabal.project- - rm -rf cabal.project cabal.project.local cabal.project.freeze- - touch cabal.project- - |- echo "packages: ${PKGDIR_linear}" >> cabal.project- - if [ $HCNUMVER -ge 80200 ] ; then echo 'package linear' >> cabal.project ; fi- - "if [ $HCNUMVER -ge 80200 ] ; then echo ' ghc-options: -Werror=missing-methods' >> cabal.project ; fi"- - |- - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(linear)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"- - cat cabal.project || true- - cat cabal.project.local || true- # Building with tests and benchmarks...- # build & run tests, build benchmarks- - ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} all- # Testing...- - ${CABAL} v2-test $WITHCOMPILER ${TEST} ${BENCH} all- # cabal check...- - (cd ${PKGDIR_linear} && ${CABAL} -vnormal check)- # haddock...- - ${CABAL} v2-haddock $WITHCOMPILER --with-haddock $HADDOCK ${TEST} ${BENCH} all--# REGENDATA ("0.10",["--output=.travis.yml","--config=cabal.haskell-ci","cabal.project"])-# EOF
CHANGELOG.markdown view
@@ -1,3 +1,11 @@+1.21.4 [2021.01.29]+-------------------+* Allow building with `vector-0.12.2` or later.+* The build-type has been changed from `Custom` to `Simple`.+ To achieve this, the `doctests` test suite has been removed in favor of using+ [`cabal-docspec`](https://github.com/phadej/cabal-extras/tree/master/cabal-docspec)+ to run the doctests.+ 1.21.3 [2020.10.03] ------------------- * Allow building with GHC 9.0.
README.markdown view
@@ -1,7 +1,7 @@ linear ====== -[](https://hackage.haskell.org/package/linear) [](http://travis-ci.org/ekmett/linear)+[](https://hackage.haskell.org/package/linear) [](https://github.com/ekmett/linear/actions?query=workflow%3AHaskell-CI) Highly polymorphic vector space operations on sparse and free vector spaces.
Setup.lhs view
@@ -1,34 +1,7 @@-\begin{code}-{-# LANGUAGE CPP #-}-{-# OPTIONS_GHC -Wall #-}-module Main (main) where--#ifndef MIN_VERSION_cabal_doctest-#define MIN_VERSION_cabal_doctest(x,y,z) 0-#endif--#if MIN_VERSION_cabal_doctest(1,0,0)--import Distribution.Extra.Doctest ( defaultMainWithDoctests )-main :: IO ()-main = defaultMainWithDoctests "doctests"--#else--#ifdef MIN_VERSION_Cabal--- If the macro is defined, we have new cabal-install,--- but for some reason we don't have cabal-doctest in package-db------ Probably we are running cabal sdist, when otherwise using new-build--- workflow-import Warning ()-#endif--import Distribution.Simple--main :: IO ()-main = defaultMain+#!/usr/bin/runhaskell+> module Main (main) where -#endif+> import Distribution.Simple -\end{code}+> main :: IO ()+> main = defaultMain
− Warning.hs
@@ -1,5 +0,0 @@-module Warning- {-# WARNING ["You are configuring this package without cabal-doctest installed.",- "The doctests test-suite will not work as a result.",- "To fix this, install cabal-doctest before configuring."] #-}- () where
linear.cabal view
@@ -1,6 +1,6 @@ name: linear category: Math, Algebra-version: 1.21.3+version: 1.21.4 license: BSD3 cabal-version: >= 1.10 license-file: LICENSE@@ -12,7 +12,7 @@ copyright: Copyright (C) 2012-2015 Edward A. Kmett synopsis: Linear Algebra description: Types and combinators for linear algebra on free vector spaces-build-type: Custom+build-type: Simple tested-with: GHC == 7.4.2 , GHC == 7.6.3 , GHC == 7.8.4@@ -25,13 +25,10 @@ , GHC == 8.10.1 extra-source-files: .gitignore- .travis.yml+ .hlint.yaml .vim.custom- travis/cabal-apt-install- travis/config CHANGELOG.markdown README.markdown- Warning.hs flag template-haskell description:@@ -50,12 +47,6 @@ type: git location: https://github.com/ekmett/linear -custom-setup- setup-depends:- base >= 4 && < 5,- Cabal,- cabal-doctest >= 1 && < 1.1- library build-depends: adjunctions >= 4 && < 5,@@ -128,19 +119,19 @@ default-language: Haskell2010 --- Verify the results of the examples+ x-docspec-extra-packages: simple-reflect++-- We need this dummy test-suite to add simple-reflect to the install plan+--+-- When cabal-install's extra-packages support becomes widely available+-- (i.e. after 3.4 release), we can remove this test-suite. test-suite doctests- type: exitcode-stdio-1.0- main-is: doctests.hs- ghc-options: -Wall -threaded- hs-source-dirs: tests- build-depends:- base,- doctest >= 0.11.1 && < 0.18,- lens,- linear,- simple-reflect >= 0.3.1- default-language: Haskell2010+ type: exitcode-stdio-1.0+ main-is: doctests.hs+ hs-source-dirs: tests+ default-language: Haskell2010++ build-depends: base, simple-reflect >= 0.3.1 test-suite UnitTests type: exitcode-stdio-1.0
src/Linear.hs view
@@ -46,5 +46,3 @@ import Linear.V3 import Linear.V4 import Linear.Vector--{-# ANN module "Hlint: ignore Use import/export shortcut" #-}
src/Linear/Affine.hs view
@@ -88,10 +88,6 @@ import Linear.Vector import System.Random -#ifdef HLINT-{-# ANN module "HLint: ignore Unused LANGUAGE pragma" #-}-#endif- -- | An affine space is roughly a vector space in which we have -- forgotten or at least pretend to have forgotten the origin. --
src/Linear/Conjugate.hs view
@@ -25,6 +25,10 @@ import Data.Word import Foreign.C.Types (CFloat, CDouble) +-- $setup+-- >>> import Data.Complex (Complex (..))++ -- | An involutive ring class Num a => Conjugate a where -- | Conjugate a value. This defaults to the trivial involution.
src/Linear/Matrix.hs view
@@ -72,9 +72,14 @@ import Linear.V #endif -#ifdef HLINT-{-# ANN module "HLint: ignore Reduce duplication" #-}-#endif+-- $setup+-- >>> import Control.Lens hiding (index)+-- >>> import Data.Complex (Complex (..))+-- >>> import Linear.V2+-- >>> import Linear.V3+-- >>> import Linear.V+-- >>> import Data.IntMap+-- >>> import Debug.SimpleReflect.Vars -- | This is a generalization of 'Control.Lens.inside' to work over any corepresentable 'Functor'. --@@ -95,12 +100,6 @@ i = tabulate $ \ e -> ipos $ go (index es e) o eb = tabulate $ \ e -> ipeek (index eb e) (go (index es e)) --- $setup--- >>> import Data.Complex--- >>> import Data.IntMap--- >>> import Debug.SimpleReflect.Vars--- >>> import Linear.V- infixl 7 !*! -- | Matrix product. This can compute any combination of sparse and dense multiplication. --@@ -245,12 +244,10 @@ (V4 d e f 0) (V4 g h i 0) (V4 j k l 1)-{-# ANN m43_to_m44 "HLint: ignore Use camelCase" #-} -- | Convert a 3x3 matrix to a 4x4 matrix extending it with 0's in the new row and column. m33_to_m44 :: Num a => M33 a -> M44 a m33_to_m44 (V3 r1 r2 r3) = V4 (vector r1) (vector r2) (vector r3) (point 0)-{-# ANN m33_to_m44 "HLint: ignore Use camelCase" #-} -- |The identity matrix for any dimension vector. --
src/Linear/Plucker.hs view
@@ -106,8 +106,6 @@ import Linear.Vector import System.Random -{-# ANN module "HLint: ignore Reduce duplication" #-}- -- | Plücker coordinates for lines in a 3-dimensional space. data Plucker a = Plucker !a !a !a !a !a !a deriving (Eq,Ord,Show,Read #if __GLASGOW_HASKELL__ >= 702
src/Linear/Projection.hs view
@@ -30,9 +30,10 @@ import Linear.Epsilon import Linear.Metric -#ifdef HLINT-{-# ANN module "HLint: ignore Reduce duplication" #-}-#endif+-- $setup+-- >>> import Linear.Matrix+-- >>> import Linear.V2+-- >>> import Linear.V4 -- | Build a look at view matrix lookAt
src/Linear/Quaternion.hs view
@@ -116,8 +116,6 @@ import Prelude hiding (any) import System.Random -{-# ANN module "HLint: ignore Reduce duplication" #-}- -- | Quaternions data Quaternion a = Quaternion !a {-# UNPACK #-}!(V3 a) deriving (Eq,Ord,Read,Show,Data,Typeable
src/Linear/Trace.hs view
@@ -50,6 +50,7 @@ -- >>> import Data.Complex -- >>> import Data.IntMap -- >>> import Debug.SimpleReflect.Vars+-- >>> import Linear.V2 class Functor m => Trace m where -- | Compute the trace of a matrix
src/Linear/V.hs view
@@ -98,7 +98,8 @@ #if __GLASGOW_HASKELL__ < 710 import Data.Traversable (sequenceA) #endif-import Data.Vector as V+import qualified Data.Vector as V+import Data.Vector (Vector) import qualified Data.Vector.Generic as G import qualified Data.Vector.Unboxed as U import qualified Data.Vector.Generic.Mutable as M@@ -127,11 +128,6 @@ #endif import System.Random --#ifdef HLINT-{-# ANN module "hlint: ignore Eta reduce" #-}-#endif- class Dim n where reflectDim :: p n -> Int @@ -240,7 +236,7 @@ instance Foldable (V n) where fold (V as) = fold as {-# INLINE fold #-}- foldMap f (V as) = foldMap f as+ foldMap f (V as) = Foldable.foldMap f as {-# INLINE foldMap #-} foldr f z (V as) = V.foldr f z as {-# INLINE foldr #-}@@ -300,15 +296,15 @@ {-# INLINE (<*>) #-} instance Bind (V n) where- V as >>- f = V $ generate (V.length as) $ \i ->- toVector (f (as `unsafeIndex` i)) `unsafeIndex` i+ V as >>- f = V $ V.generate (V.length as) $ \i ->+ toVector (f (as `V.unsafeIndex` i)) `V.unsafeIndex` i {-# INLINE (>>-) #-} instance Dim n => Monad (V n) where return = V . V.replicate (reflectDim (Proxy :: Proxy n)) {-# INLINE return #-}- V as >>= f = V $ generate (reflectDim (Proxy :: Proxy n)) $ \i ->- toVector (f (as `unsafeIndex` i)) `unsafeIndex` i+ V as >>= f = V $ V.generate (reflectDim (Proxy :: Proxy n)) $ \i ->+ toVector (f (as `V.unsafeIndex` i)) `V.unsafeIndex` i {-# INLINE (>>=) #-} instance Dim n => Additive (V n) where@@ -382,7 +378,7 @@ {-# INLINE acosh #-} instance Dim n => Distributive (V n) where- distribute f = V $ V.generate (reflectDim (Proxy :: Proxy n)) $ \i -> fmap (\(V v) -> unsafeIndex v i) f+ distribute f = V $ V.generate (reflectDim (Proxy :: Proxy n)) $ \i -> fmap (\(V v) -> V.unsafeIndex v i) f {-# INLINE distribute #-} instance Hashable a => Hashable (V n a) where@@ -404,10 +400,10 @@ alignment _ = alignment (undefined :: a) {-# INLINE alignment #-} poke ptr (V xs) = Foldable.forM_ [0..reflectDim (Proxy :: Proxy n)-1] $ \i ->- pokeElemOff ptr' i (unsafeIndex xs i)+ pokeElemOff ptr' i (V.unsafeIndex xs i) where ptr' = castPtr ptr {-# INLINE poke #-}- peek ptr = V <$> generateM (reflectDim (Proxy :: Proxy n)) (peekElemOff ptr')+ peek ptr = V <$> V.generateM (reflectDim (Proxy :: Proxy n)) (peekElemOff ptr') where ptr' = castPtr ptr {-# INLINE peek #-} @@ -475,7 +471,7 @@ instance Dim n => Representable (V n) where type Rep (V n) = Int- tabulate = V . generate (reflectDim (Proxy :: Proxy n))+ tabulate = V . V.generate (reflectDim (Proxy :: Proxy n)) {-# INLINE tabulate #-} index (V xs) i = xs V.! i {-# INLINE index #-}@@ -519,10 +515,10 @@ #endif instance (Typeable1 (V n), Typeable (V n a), Dim n, Data a) => Data (V n a) where- gfoldl f z (V as) = z (V . fromList) `f` V.toList as+ gfoldl f z (V as) = z (V . V.fromList) `f` V.toList as toConstr _ = vConstr gunfold k z c = case constrIndex c of- 1 -> k (z (V . fromList))+ 1 -> k (z (V . V.fromList)) _ -> error "gunfold" dataTypeOf _ = vDataType dataCast1 f = gcast1 f
src/Linear/V0.hs view
@@ -97,7 +97,10 @@ import Prelude hiding (sum) -- $setup+-- >>> import Control.Applicative -- >>> import Control.Lens+-- >>> import qualified Data.Foldable as F+-- >>> let sum xs = F.sum xs -- | A 0-dimensional vector --
src/Linear/V1.hs view
@@ -101,13 +101,11 @@ import qualified Data.Vector.Generic as G import qualified Data.Vector.Unboxed.Base as U -#ifdef HLINT--- HLint is delusional-{-# ANN module "HLint: ignore Unused LANGUAGE pragma" #-}-#endif- -- $setup+-- >>> import Control.Applicative -- >>> import Control.Lens+-- >>> import qualified Data.Foldable as F+-- >>> let sum xs = F.sum xs -- | A 1-dimensional vector --
src/Linear/V2.hs view
@@ -106,7 +106,10 @@ import System.Random -- $setup+-- >>> import Control.Applicative -- >>> import Control.Lens+-- >>> import qualified Data.Foldable as F+-- >>> let sum xs = F.sum xs -- | A 2-dimensional vector --
src/Linear/V3.hs view
@@ -102,7 +102,8 @@ import Linear.Vector import System.Random -{-# ANN module "HLint: ignore Reduce duplication" #-}+-- $setup+-- >>> import Control.Lens hiding (index) -- | A 3-dimensional vector data V3 a = V3 !a !a !a deriving (Eq,Ord,Show,Read,Data,Typeable
src/Linear/V4.hs view
@@ -109,7 +109,8 @@ import Linear.Vector import System.Random -{-# ANN module "HLint: ignore Reduce duplication" #-}+-- $setup+-- >>> import Control.Lens hiding (index) -- | A 4-dimensional vector. data V4 a = V4 !a !a !a !a deriving (Eq,Ord,Show,Read,Data,Typeable
src/Linear/Vector.hs view
@@ -51,15 +51,14 @@ #if __GLASGOW_HASKELL__ < 710 import Data.Monoid (mempty) #endif-import Data.Vector as Vector-import Data.Vector.Mutable as Mutable+import qualified Data.Vector as Vector+import Data.Vector (Vector)+import qualified Data.Vector.Mutable as Mutable #ifdef USE_GHC_GENERICS import GHC.Generics #endif import Linear.Instances () -{-# ANN module "HLint: ignore Redundant lambda" #-}- -- $setup -- >>> import Linear.V2 @@ -215,10 +214,10 @@ {-# INLINE zero #-} liftU2 f u v = case compare lu lv of LT | lu == 0 -> v- | otherwise -> Vector.modify (\ w -> Foldable.forM_ [0..lu-1] $ \i -> unsafeWrite w i $ f (unsafeIndex u i) (unsafeIndex v i)) v+ | otherwise -> Vector.modify (\ w -> Foldable.forM_ [0..lu-1] $ \i -> Mutable.unsafeWrite w i $ f (Vector.unsafeIndex u i) (Vector.unsafeIndex v i)) v EQ -> Vector.zipWith f u v GT | lv == 0 -> u- | otherwise -> Vector.modify (\ w -> Foldable.forM_ [0..lv-1] $ \i -> unsafeWrite w i $ f (unsafeIndex u i) (unsafeIndex v i)) u+ | otherwise -> Vector.modify (\ w -> Foldable.forM_ [0..lv-1] $ \i -> Mutable.unsafeWrite w i $ f (Vector.unsafeIndex u i) (Vector.unsafeIndex v i)) u where lu = Vector.length u lv = Vector.length v
tests/doctests.hs view
@@ -7,19 +7,13 @@ -- Stability : provisional -- Portability : portable ----- This module provides doctests for a project based on the actual versions--- of the packages it was built with. It requires a corresponding Setup.lhs--- to be added to the project+-- This module exists to add dependencies ----------------------------------------------------------------------------- module Main where -import Build_doctests (flags, pkgs, module_sources)-import Data.Foldable (traverse_)-import Test.DocTest- main :: IO () main = do- traverse_ putStrLn args- doctest args- where- args = flags ++ pkgs ++ module_sources+ putStrLn "This test-suite exists only to add dependencies"+ putStrLn "To run doctests: "+ putStrLn " cabal build all --enable-tests"+ putStrLn " cabal-docspec"
− travis/cabal-apt-install
@@ -1,27 +0,0 @@-#! /bin/bash-set -eu--APT="sudo apt-get -q -y"-CABAL_INSTALL_DEPS="cabal install --only-dependencies --force-reinstall"--$APT update-$APT install dctrl-tools--# Find potential system packages to satisfy cabal dependencies-deps()-{- local M='^\([^ ]\+\)-[0-9.]\+ (.*$'- local G=' -o ( -FPackage -X libghc-\L\1\E-dev )'- local E="$($CABAL_INSTALL_DEPS "$@" --dry-run -v 2> /dev/null \- | sed -ne "s/$M/$G/p" | sort -u)"- grep-aptavail -n -sPackage \( -FNone -X None \) $E | sort -u-}--$APT install $(deps "$@") libghc-quickcheck2-dev # QuickCheck is special-$CABAL_INSTALL_DEPS "$@" # Install the rest via Hackage--if ! $APT install hlint ; then- $APT install $(deps hlint)- cabal install hlint-fi-
− travis/config
@@ -1,16 +0,0 @@--- This provides a custom ~/.cabal/config file for use when hackage is down that should work on unix------ This is particularly useful for travis-ci to get it to stop complaining--- about a broken build when everything is still correct on our end.------ This uses Luite Stegeman's mirror of hackage provided by his 'hdiff' site instead------ To enable this, uncomment the before_script in .travis.yml--remote-repo: hdiff.luite.com:http://hdiff.luite.com/packages/archive-remote-repo-cache: ~/.cabal/packages-world-file: ~/.cabal/world-build-summary: ~/.cabal/logs/build.log-remote-build-reporting: anonymous-install-dirs user-install-dirs global