Hello community, here is the log from the commit of package ghc-linear for openSUSE:Factory checked in at 2017-06-04 01:54:40 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-linear (Old) and /work/SRC/openSUSE:Factory/.ghc-linear.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-linear" Sun Jun 4 01:54:40 2017 rev:3 rq:494173 version:1.20.6 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-linear/ghc-linear.changes 2017-03-18 20:50:31.234133262 +0100 +++ /work/SRC/openSUSE:Factory/.ghc-linear.new/ghc-linear.changes 2017-06-04 01:54:41.515745517 +0200 @@ -1,0 +2,5 @@ +Wed May 3 08:24:09 UTC 2017 - [email protected] + +- Update to version 1.20.6 with cabal2obs. + +------------------------------------------------------------------- Old: ---- linear-1.20.5.tar.gz linear.cabal New: ---- linear-1.20.6.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-linear.spec ++++++ --- /var/tmp/diff_new_pack.sNZXpH/_old 2017-06-04 01:54:42.127659065 +0200 +++ /var/tmp/diff_new_pack.sNZXpH/_new 2017-06-04 01:54:42.127659065 +0200 @@ -19,19 +19,19 @@ %global pkg_name linear %bcond_with tests Name: ghc-%{pkg_name} -Version: 1.20.5 +Version: 1.20.6 Release: 0 Summary: Linear Algebra License: BSD-3-Clause Group: Development/Languages/Other Url: https://hackage.haskell.org/package/%{pkg_name} Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz -Source1: https://hackage.haskell.org/package/%{pkg_name}-%{version}/revision/1.cabal#/%{pkg_name}.cabal BuildRequires: ghc-Cabal-devel BuildRequires: ghc-adjunctions-devel BuildRequires: ghc-base-orphans-devel BuildRequires: ghc-binary-devel BuildRequires: ghc-bytes-devel +BuildRequires: ghc-cabal-doctest-devel BuildRequires: ghc-cereal-devel BuildRequires: ghc-containers-devel BuildRequires: ghc-deepseq-devel @@ -53,9 +53,7 @@ %if %{with tests} BuildRequires: ghc-HUnit-devel BuildRequires: ghc-bytestring-devel -BuildRequires: ghc-directory-devel BuildRequires: ghc-doctest-devel -BuildRequires: ghc-filepath-devel BuildRequires: ghc-simple-reflect-devel BuildRequires: ghc-test-framework-devel BuildRequires: ghc-test-framework-hunit-devel @@ -77,7 +75,6 @@ %prep %setup -q -n %{pkg_name}-%{version} -cp -p %{SOURCE1} %{pkg_name}.cabal %build %ghc_lib_build ++++++ linear-1.20.5.tar.gz -> linear-1.20.6.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linear-1.20.5/.gitignore new/linear-1.20.6/.gitignore --- old/linear-1.20.5/.gitignore 2016-05-29 17:58:12.000000000 +0200 +++ new/linear-1.20.6/.gitignore 2017-04-27 04:21:14.000000000 +0200 @@ -1,4 +1,5 @@ dist +dist-newstyle docs wiki TAGS @@ -11,3 +12,4 @@ *.hi *~ *# +.stack-work/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linear-1.20.5/.travis.yml new/linear-1.20.6/.travis.yml --- old/linear-1.20.5/.travis.yml 2016-05-29 17:58:12.000000000 +0200 +++ new/linear-1.20.6/.travis.yml 2017-04-27 04:21:14.000000000 +0200 @@ -1,30 +1,90 @@ -env: - - 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 +# This file has been generated -- see https://github.com/hvr/multi-ghc-travis +language: c +sudo: false + +cache: + directories: + - $HOME/.cabsnap + - $HOME/.cabal/packages + +before_cache: + - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log + - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.tar matrix: + include: + - env: CABALVER=1.18 GHCVER=7.4.2 + compiler: ": #GHC 7.4.2" + addons: {apt: {packages: [cabal-install-1.18,ghc-7.4.2], sources: [hvr-ghc]}} + - env: CABALVER=1.18 GHCVER=7.6.3 + compiler: ": #GHC 7.6.3" + addons: {apt: {packages: [cabal-install-1.18,ghc-7.6.3], sources: [hvr-ghc]}} + - env: CABALVER=1.18 GHCVER=7.8.4 + compiler: ": #GHC 7.8.4" + addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4], sources: [hvr-ghc]}} + - env: CABALVER=1.24 GHCVER=7.10.3 + compiler: ": #GHC 7.10.3" + addons: {apt: {packages: [cabal-install-1.24,ghc-7.10.3], sources: [hvr-ghc]}} + - env: CABALVER=1.24 GHCVER=8.0.2 + compiler: ": #GHC 8.0.2" + addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.2], sources: [hvr-ghc]}} + - env: CABALVER=1.24 GHCVER=8.2.1 + compiler: ": #GHC 8.2.1" + addons: {apt: {packages: [cabal-install-1.24,ghc-8.2.1], sources: [hvr-ghc]}} + - env: CABALVER=1.24 GHCVER=head + compiler: ": #GHC head" + addons: {apt: {packages: [cabal-install-1.24,ghc-head], sources: [hvr-ghc]}} + allow_failures: - - env: GHCVER=head CABALVER=1.24 + - env: CABALVER=1.24 GHCVER=head before_install: - - travis_retry sudo add-apt-repository -y ppa:hvr/ghc - - travis_retry sudo apt-get update - - travis_retry sudo apt-get install cabal-install-$CABALVER ghc-$GHCVER + - unset CC - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH - - cabal --version install: - - travis_retry cabal update - - cabal install --enable-tests --only-dependencies + - cabal --version + - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]" + - if [ -f $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz ]; + then + zcat $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz > + $HOME/.cabal/packages/hackage.haskell.org/00-index.tar; + fi + - travis_retry cabal update -v + - sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config + - cabal install --only-dependencies --enable-tests --enable-benchmarks --dry -v > installplan.txt + - sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt +# check whether current requested install-plan matches cached package-db snapshot + - if diff -u installplan.txt $HOME/.cabsnap/installplan.txt; + then + echo "cabal build-cache HIT"; + rm -rfv .ghc; + cp -a $HOME/.cabsnap/ghc $HOME/.ghc; + cp -a $HOME/.cabsnap/lib $HOME/.cabsnap/share $HOME/.cabsnap/bin $HOME/.cabal/; + else + echo "cabal build-cache MISS"; + rm -rf $HOME/.cabsnap; + mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin; + cabal install -j --only-dependencies --enable-tests --enable-benchmarks; + fi + +# snapshot package-db on cache miss + - if [ ! -d $HOME/.cabsnap ]; + then + echo "snapshotting package-db to build-cache"; + mkdir $HOME/.cabsnap; + cp -a $HOME/.ghc $HOME/.cabsnap/ghc; + cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin installplan.txt $HOME/.cabsnap/; + fi + +# Here starts the actual work to be performed for the package under test; +# any command which exits with a non-zero exit code causes the build to fail. script: - - cabal configure -v2 --enable-tests - - cabal build - - cabal sdist + - cabal configure -v2 --enable-tests --enable-benchmarks # -v2 provides useful information for debugging + - cabal build # this builds all libraries and executables (including tests/benchmarks) + - cabal test + - cabal sdist # tests that a source-distribution can be generated - export SRC_TGZ=$(cabal info . | awk '{print $2 ".tar.gz";exit}') ; cd dist/; if [ -f "$SRC_TGZ" ]; then @@ -41,3 +101,5 @@ skip_join: true template: - "\x0313linear\x0f/\x0306%{branch}\x0f \x0314%{commit}\x0f %{message} \x0302\x1f%{build_url}\x0f" + +# EOF diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linear-1.20.5/CHANGELOG.markdown new/linear-1.20.6/CHANGELOG.markdown --- old/linear-1.20.5/CHANGELOG.markdown 2016-05-29 17:58:12.000000000 +0200 +++ new/linear-1.20.6/CHANGELOG.markdown 2017-04-27 04:21:14.000000000 +0200 @@ -1,3 +1,15 @@ +1.20.6 +------ +* Revamp `Setup.hs` to use `cabal-doctest`. This makes it build + with `Cabal-2.0`, and makes the `doctest`s work with `cabal new-build` and + sandboxes. +* Make `(1 / x)` and `recip x` agree in the `Fractional` instance for `Quaternion` +* Use newtype instances for `Point` vectors in `Linear.Affine` +* Enable `PolyKinds` in `Linear.Trace`. Also enable `PolyKinds` when GHC 7.6 or + later is used (previously, it was GHC 7.8 or later). +* Fix a segfault arising from the `MVector` instance for `V` +* Add `Finite` class for conversion between `V` and fixed-size vector types + 1.20.5 ------ * GHC 8 compatibility diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linear-1.20.5/README.markdown new/linear-1.20.6/README.markdown --- old/linear-1.20.5/README.markdown 2016-05-29 17:58:12.000000000 +0200 +++ new/linear-1.20.6/README.markdown 2017-04-27 04:21:14.000000000 +0200 @@ -1,6 +1,8 @@ linear ====== +[](https://hackage.haskell.org/package/linear) [](http://travis-ci.org/ekmett/linear) + Highly polymorphic vector space operations on sparse and free vector spaces. Contact Information diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linear-1.20.5/Setup.lhs new/linear-1.20.6/Setup.lhs --- old/linear-1.20.5/Setup.lhs 2016-05-29 17:58:12.000000000 +0200 +++ new/linear-1.20.6/Setup.lhs 2017-04-27 04:21:14.000000000 +0200 @@ -1,48 +1,182 @@ -#!/usr/bin/runhaskell \begin{code} -{-# OPTIONS_GHC -Wall #-} +{-# LANGUAGE CPP #-} +{-# LANGUAGE OverloadedStrings #-} 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 ) +#else + +-- Otherwise we provide a shim + +#ifndef MIN_VERSION_Cabal +#define MIN_VERSION_Cabal(x,y,z) 0 +#endif +#ifndef MIN_VERSION_directory +#define MIN_VERSION_directory(x,y,z) 0 +#endif +#if MIN_VERSION_Cabal(1,24,0) +#define InstalledPackageId UnitId +#endif + +import Control.Monad ( when ) import Data.List ( nub ) -import Data.Version ( showVersion ) -import Distribution.Package ( PackageName(PackageName), PackageId, InstalledPackageId, packageVersion, packageName ) -import Distribution.PackageDescription ( PackageDescription(), TestSuite(..) ) +import Data.String ( fromString ) +import Distribution.Package ( InstalledPackageId ) +import Distribution.Package ( PackageId, Package (..), packageVersion ) +import Distribution.PackageDescription ( PackageDescription(), TestSuite(..) , Library (..), BuildInfo (..)) import Distribution.Simple ( defaultMainWithHooks, UserHooks(..), simpleUserHooks ) import Distribution.Simple.Utils ( rewriteFile, createDirectoryIfMissingVerbose ) import Distribution.Simple.BuildPaths ( autogenModulesDir ) -import Distribution.Simple.Setup ( BuildFlags(buildVerbosity), fromFlag ) -import Distribution.Simple.LocalBuildInfo ( withLibLBI, withTestLBI, LocalBuildInfo(), ComponentLocalBuildInfo(componentPackageDeps) ) -import Distribution.Verbosity ( Verbosity ) +import Distribution.Simple.Setup ( BuildFlags(buildDistPref, buildVerbosity), fromFlag) +import Distribution.Simple.LocalBuildInfo ( withPackageDB, withLibLBI, withTestLBI, LocalBuildInfo(), ComponentLocalBuildInfo(componentPackageDeps), compiler ) +import Distribution.Simple.Compiler ( showCompilerId , PackageDB (..)) +import Distribution.Text ( display , simpleParse ) import System.FilePath ( (</>) ) -main :: IO () -main = defaultMainWithHooks simpleUserHooks - { buildHook = \pkg lbi hooks flags -> do - generateBuildModule (fromFlag (buildVerbosity flags)) pkg lbi - buildHook simpleUserHooks pkg lbi hooks flags - } +#if MIN_VERSION_Cabal(1,25,0) +import Distribution.Simple.BuildPaths ( autogenComponentModulesDir ) +#endif + +#if MIN_VERSION_directory(1,2,2) +import System.Directory (makeAbsolute) +#else +import System.Directory (getCurrentDirectory) +import System.FilePath (isAbsolute) + +makeAbsolute :: FilePath -> IO FilePath +makeAbsolute p | isAbsolute p = return p + | otherwise = do + cwd <- getCurrentDirectory + return $ cwd </> p +#endif + +generateBuildModule :: String -> BuildFlags -> PackageDescription -> LocalBuildInfo -> IO () +generateBuildModule testsuiteName flags pkg lbi = do + let verbosity = fromFlag (buildVerbosity flags) + let distPref = fromFlag (buildDistPref flags) + + -- Package DBs + let dbStack = withPackageDB lbi ++ [ SpecificPackageDB $ distPref </> "package.conf.inplace" ] + let dbFlags = "-hide-all-packages" : packageDbArgs dbStack + + withLibLBI pkg lbi $ \lib libcfg -> do + let libBI = libBuildInfo lib + + -- modules + let modules = exposedModules lib ++ otherModules libBI + -- it seems that doctest is happy to take in module names, not actual files! + let module_sources = modules + + -- We need the directory with library's cabal_macros.h! +#if MIN_VERSION_Cabal(1,25,0) + let libAutogenDir = autogenComponentModulesDir lbi libcfg +#else + let libAutogenDir = autogenModulesDir lbi +#endif -generateBuildModule :: Verbosity -> PackageDescription -> LocalBuildInfo -> IO () -generateBuildModule verbosity pkg lbi = do - let dir = autogenModulesDir lbi - createDirectoryIfMissingVerbose verbosity True dir - withLibLBI pkg lbi $ \_ libcfg -> do - withTestLBI pkg lbi $ \suite suitecfg -> do - rewriteFile (dir </> "Build_" ++ testName suite ++ ".hs") $ unlines - [ "module Build_" ++ testName suite ++ " where" + -- Lib sources and includes + iArgs <- mapM (fmap ("-i"++) . makeAbsolute) $ libAutogenDir : hsSourceDirs libBI + includeArgs <- mapM (fmap ("-I"++) . makeAbsolute) $ includeDirs libBI + + -- CPP includes, i.e. include cabal_macros.h + let cppFlags = map ("-optP"++) $ + [ "-include", libAutogenDir ++ "/cabal_macros.h" ] + ++ cppOptions libBI + + withTestLBI pkg lbi $ \suite suitecfg -> when (testName suite == fromString testsuiteName) $ do + + -- get and create autogen dir +#if MIN_VERSION_Cabal(1,25,0) + let testAutogenDir = autogenComponentModulesDir lbi suitecfg +#else + let testAutogenDir = autogenModulesDir lbi +#endif + createDirectoryIfMissingVerbose verbosity True testAutogenDir + + -- write autogen'd file + rewriteFile (testAutogenDir </> "Build_doctests.hs") $ unlines + [ "module Build_doctests where" , "" - , "autogen_dir :: String" - , "autogen_dir = " ++ show dir + -- -package-id etc. flags + , "pkgs :: [String]" + , "pkgs = " ++ (show $ formatDeps $ testDeps libcfg suitecfg) , "" - , "deps :: [String]" - , "deps = " ++ (show $ formatdeps (testDeps libcfg suitecfg)) + , "flags :: [String]" + , "flags = " ++ show (iArgs ++ includeArgs ++ dbFlags ++ cppFlags) + , "" + , "module_sources :: [String]" + , "module_sources = " ++ show (map display module_sources) ] where - formatdeps = map (formatone . snd) - formatone p = case packageName p of - PackageName n -> n ++ "-" ++ showVersion (packageVersion p) + -- we do this check in Setup, as then doctests don't need to depend on Cabal + isOldCompiler = maybe False id $ do + a <- simpleParse $ showCompilerId $ compiler lbi + b <- simpleParse "7.5" + return $ packageVersion (a :: PackageId) < b + + formatDeps = map formatOne + formatOne (installedPkgId, pkgId) + -- The problem is how different cabal executables handle package databases + -- when doctests depend on the library + | packageId pkg == pkgId = "-package=" ++ display pkgId + | otherwise = "-package-id=" ++ display installedPkgId + + -- From Distribution.Simple.Program.GHC + packageDbArgs :: [PackageDB] -> [String] + packageDbArgs | isOldCompiler = packageDbArgsConf + | otherwise = packageDbArgsDb + + -- GHC <7.6 uses '-package-conf' instead of '-package-db'. + packageDbArgsConf :: [PackageDB] -> [String] + packageDbArgsConf dbstack = case dbstack of + (GlobalPackageDB:UserPackageDB:dbs) -> concatMap specific dbs + (GlobalPackageDB:dbs) -> ("-no-user-package-conf") + : concatMap specific dbs + _ -> ierror + where + specific (SpecificPackageDB db) = [ "-package-conf=" ++ db ] + specific _ = ierror + ierror = error $ "internal error: unexpected package db stack: " + ++ show dbstack + + -- GHC >= 7.6 uses the '-package-db' flag. See + -- https://ghc.haskell.org/trac/ghc/ticket/5977. + packageDbArgsDb :: [PackageDB] -> [String] + -- special cases to make arguments prettier in common scenarios + packageDbArgsDb dbstack = case dbstack of + (GlobalPackageDB:UserPackageDB:dbs) + | all isSpecific dbs -> concatMap single dbs + (GlobalPackageDB:dbs) + | all isSpecific dbs -> "-no-user-package-db" + : concatMap single dbs + dbs -> "-clear-package-db" + : concatMap single dbs + where + single (SpecificPackageDB db) = [ "-package-db=" ++ db ] + single GlobalPackageDB = [ "-global-package-db" ] + single UserPackageDB = [ "-user-package-db" ] + isSpecific (SpecificPackageDB _) = True + isSpecific _ = False testDeps :: ComponentLocalBuildInfo -> ComponentLocalBuildInfo -> [(InstalledPackageId, PackageId)] testDeps xs ys = nub $ componentPackageDeps xs ++ componentPackageDeps ys +defaultMainWithDoctests :: String -> IO () +defaultMainWithDoctests testSuiteName = defaultMainWithHooks simpleUserHooks + { buildHook = \pkg lbi hooks flags -> do + generateBuildModule testSuiteName flags pkg lbi + buildHook simpleUserHooks pkg lbi hooks flags + } + +#endif + +main :: IO () +main = defaultMainWithDoctests "doctests" + \end{code} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linear-1.20.5/linear.cabal new/linear-1.20.6/linear.cabal --- old/linear-1.20.5/linear.cabal 2016-05-29 17:58:12.000000000 +0200 +++ new/linear-1.20.6/linear.cabal 2017-04-27 04:21:14.000000000 +0200 @@ -1,6 +1,6 @@ name: linear category: Math, Algebra -version: 1.20.5 +version: 1.20.6 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, GHC==8.0.1 +tested-with: GHC == 7.4.2, GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.3, GHC==8.0.2, GHC==8.2.1 extra-source-files: .gitignore .travis.yml @@ -38,7 +38,13 @@ source-repository head type: git - location: git://github.com/ekmett/linear.git + location: https://github.com/ekmett/linear + +custom-setup + setup-depends: + base >= 4 && < 5, + Cabal, + cabal-doctest >= 1 && < 1.1 library build-depends: @@ -61,7 +67,7 @@ transformers >= 0.2 && < 0.6, transformers-compat >= 0.4 && < 1, unordered-containers >= 0.2.3 && < 0.3, - vector >= 0.10 && < 0.12, + vector >= 0.10 && < 0.13, void >= 0.6 && < 1 if flag(template-haskell) && impl(ghc) @@ -111,9 +117,7 @@ hs-source-dirs: tests build-depends: base, - directory >= 1.0 && < 1.3, - doctest >= 0.8 && < 0.12, - filepath >= 1.3 && < 1.5, + doctest >= 0.11.1 && < 0.12, lens, simple-reflect >= 0.3.1 @@ -121,15 +125,19 @@ type: exitcode-stdio-1.0 main-is: UnitTests.hs other-modules: Plucker, Binary + if impl(ghc >= 7.7) + other-modules: V ghc-options: -Wall -threaded hs-source-dirs: tests build-depends: base, binary, bytestring, + deepseq, test-framework >= 0.8, test-framework-hunit >= 0.3, HUnit >= 1.2.5, - linear - + linear, + reflection, + vector diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linear-1.20.5/src/Linear/Affine.hs new/linear-1.20.6/src/Linear/Affine.hs --- old/linear-1.20.5/src/Linear/Affine.hs 2016-05-29 17:58:12.000000000 +0200 +++ new/linear-1.20.6/src/Linear/Affine.hs 2017-04-27 04:21:14.000000000 +0200 @@ -12,7 +12,7 @@ {-# LANGUAGE DeriveGeneric #-} #endif {-# LANGUAGE DeriveDataTypeable #-} -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ < 708 +#if defined(__GLASGOW_HASKELL__) {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE ScopedTypeVariables #-} #endif @@ -33,6 +33,9 @@ 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 @@ -47,6 +50,9 @@ import Data.Map (Map) 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) @@ -54,9 +60,6 @@ #if __GLASGOW_HASKELL__ >= 706 import GHC.Generics (Generic1) #endif -import qualified Data.Vector.Generic.Mutable as M -import qualified Data.Vector.Generic as G -import qualified Data.Vector.Unboxed.Base as U import Linear.Epsilon import Linear.Metric import Linear.Plucker @@ -149,6 +152,13 @@ #endif ) +#if __GLASGOW_HASKELL__ >= 707 +instance Finite f => Finite (Point f) where + type Size (Point f) = Size f + toV (P v) = toV v + fromV v = P (fromV v) +#endif + instance NFData (f a) => NFData (Point f a) where rnf (P x) = rnf x @@ -190,17 +200,47 @@ _Wrapped' = _Point {-# INLINE _Wrapped' #-} +#if __GLASGOW_HASKELL__ >= 708 +-- These are stolen from Data.Profunctor.Unsafe +(.#) :: Coercible b a => (b -> c) -> (a -> b) -> a -> c +f .# _ = coerce f +{-# INLINE (.#) #-} + +(#.) :: Coercible c b => (b -> c) -> (a -> b) -> a -> c +(#.) _ = coerce (\x -> 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 (P x) = 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 - join (P m) = P $ join $ fmap (\(P m')->m') m +#if __GLASGOW_HASKELL__ >= 708 + (>>-) = ((P .) . (. (unP .))) #. (>>-) .# unP +#else + P m >>- f = P $ m >>- unP . f +#endif + join (P m) = P $ m >>- \(P m') -> m' instance Distributive f => Distributive (Point f) where distribute = P . collect (\(P p) -> p) + collect = (P .) #. collect .# (unP .) instance Representable f => Representable (Point f) where type Rep (Point f) = Rep f - tabulate f = P (tabulate f) + tabulate = P #. tabulate {-# INLINE tabulate #-} - index (P xs) = Rep.index xs + index = Rep.index .# unP {-# INLINE index #-} type instance Index (Point f a) = Index (f a) @@ -238,11 +278,11 @@ instance Additive f => Affine (Point f) where type Diff (Point f) = f - P x .-. P y = x ^-^ y + (.-.) = (. unP) #. (^-^) .# unP {-# INLINE (.-.) #-} - P x .+^ v = P (x ^+^ v) + (.+^) = (P .) #. (^+^) .# unP {-# INLINE (.+^) #-} - P x .-^ v = P (x ^-^ v) + (.-^) = (P .) #. (^-^) .# unP {-# INLINE (.-^) #-} -- | Vector spaces have origins. @@ -255,8 +295,8 @@ relative p0 = iso (.-. p0) (p0 .+^) {-# INLINE relative #-} -data instance U.Vector (Point f a) = V_P !(U.Vector (f a)) -data instance U.MVector s (Point f a) = MV_P !(U.MVector s (f a)) +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 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linear-1.20.5/src/Linear/Matrix.hs new/linear-1.20.6/src/Linear/Matrix.hs --- old/linear-1.20.5/src/Linear/Matrix.hs 2016-05-29 17:58:12.000000000 +0200 +++ new/linear-1.20.6/src/Linear/Matrix.hs 2017-04-27 04:21:14.000000000 +0200 @@ -167,7 +167,7 @@ type M22 a = V2 (V2 a) -- | A 2x3 matrix with row-major representation type M23 a = V2 (V3 a) --- | A 2x3 matrix with row-major representation +-- | A 2x4 matrix with row-major representation type M24 a = V2 (V4 a) -- | A 3x2 matrix with row-major representation type M32 a = V3 (V2 a) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linear-1.20.5/src/Linear/Plucker.hs new/linear-1.20.6/src/Linear/Plucker.hs --- old/linear-1.20.5/src/Linear/Plucker.hs 2016-05-29 17:58:12.000000000 +0200 +++ new/linear-1.20.6/src/Linear/Plucker.hs 2017-04-27 04:21:14.000000000 +0200 @@ -4,10 +4,13 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE GADTs #-} -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702 +#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} {-# LANGUAGE DeriveGeneric #-} #endif +#if __GLASGOW_HASKELL__ >= 707 +{-# LANGUAGE DataKinds #-} +#endif #ifndef MIN_VERSION_vector #define MIN_VERSION_vector(x,y,z) 1 @@ -70,21 +73,26 @@ import Data.Semigroup import Data.Semigroup.Foldable import Data.Serialize as Cereal +#if __GLASGOW_HASKELL__ >= 707 +import qualified Data.Vector as V +#endif +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.Ptr (castPtr) import Foreign.Storable (Storable(..)) import GHC.Arr (Ix(..)) -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702 +#if __GLASGOW_HASKELL__ >= 702 import GHC.Generics (Generic) #endif -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 706 +#if __GLASGOW_HASKELL__ >= 706 import GHC.Generics (Generic1) #endif -import qualified Data.Vector.Generic.Mutable as M -import qualified Data.Vector.Generic as G -import qualified Data.Vector.Unboxed.Base as U - import Linear.Epsilon import Linear.Metric +#if __GLASGOW_HASKELL__ >= 707 +import Linear.V +#endif import Linear.V2 import Linear.V3 import Linear.V4 @@ -94,14 +102,21 @@ -- | 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 defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702 +#if __GLASGOW_HASKELL__ >= 702 ,Generic #endif -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 706 +#if __GLASGOW_HASKELL__ >= 706 ,Generic1 #endif ) +#if __GLASGOW_HASKELL__ >= 707 +instance Finite Plucker where + type Size Plucker = 6 + toV (Plucker a b c d e f) = V (V.fromListN 6 [a,b,c,d,e,f]) + fromV (V v) = Plucker (v V.! 0) (v V.! 1) (v V.! 2) (v V.! 3) (v V.! 4) (v V.! 5) +#endif + instance Functor Plucker where fmap g (Plucker a b c d e f) = Plucker (g a) (g b) (g c) (g d) (g e) (g f) {-# INLINE fmap #-} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linear-1.20.5/src/Linear/Quaternion.hs new/linear-1.20.6/src/Linear/Quaternion.hs --- old/linear-1.20.5/src/Linear/Quaternion.hs 2016-05-29 17:58:12.000000000 +0200 +++ new/linear-1.20.6/src/Linear/Quaternion.hs 2017-04-27 04:21:14.000000000 +0200 @@ -5,10 +5,13 @@ {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE CPP #-} {-# LANGUAGE TypeFamilies #-} -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702 +#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} {-# LANGUAGE DeriveGeneric #-} #endif +#if __GLASGOW_HASKELL__ >= 707 +{-# LANGUAGE DataKinds #-} +#endif #ifndef MIN_VERSION_vector #define MIN_VERSION_vector(x,y,z) 1 @@ -62,20 +65,26 @@ import GHC.Arr (Ix(..)) import qualified Data.Foldable as F import Data.Monoid +#if __GLASGOW_HASKELL__ >= 707 +import qualified Data.Vector as V +#endif +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.Ptr (castPtr, plusPtr) import Foreign.Storable (Storable(..)) -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702 +#if __GLASGOW_HASKELL__ >= 702 import GHC.Generics (Generic) #endif -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 706 +#if __GLASGOW_HASKELL__ >= 706 import GHC.Generics (Generic1) #endif -import qualified Data.Vector.Generic.Mutable as M -import qualified Data.Vector.Generic as G -import qualified Data.Vector.Unboxed.Base as U import Linear.Epsilon import Linear.Conjugate import Linear.Metric +#if __GLASGOW_HASKELL__ >= 707 +import Linear.V +#endif import Linear.V3 import Linear.Vector import Prelude hiding (any) @@ -93,6 +102,13 @@ #endif ) +#if __GLASGOW_HASKELL__ >= 707 +instance Finite Quaternion where + type Size Quaternion = 4 + toV (Quaternion a (V3 b c d)) = V (V.fromListN 4 [a, b, c, d]) + fromV (V v) = Quaternion (v V.! 0) (V3 (v V.! 1) (v V.! 2) (v V.! 3)) +#endif + instance Functor Quaternion where fmap f (Quaternion e v) = Quaternion (f e) (fmap f v) {-# INLINE fmap #-} @@ -261,7 +277,7 @@ (r0*q3-r1*q2+r2*q1-r3*q0)) ^/ (r0*r0 + r1*r1 + r2*r2 + r3*r3) {-# INLINE (/) #-} - recip q = q ^/ quadrance q + recip q@(Quaternion e v) = Quaternion e (negate v) ^/ quadrance q {-# INLINE recip #-} fromRational x = Quaternion (fromRational x) 0 {-# INLINE fromRational #-} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linear-1.20.5/src/Linear/Trace.hs new/linear-1.20.6/src/Linear/Trace.hs --- old/linear-1.20.5/src/Linear/Trace.hs 2016-05-29 17:58:12.000000000 +0200 +++ new/linear-1.20.6/src/Linear/Trace.hs 2017-04-27 04:21:14.000000000 +0200 @@ -1,6 +1,9 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE DefaultSignatures #-} +#if __GLASGOW_HASKELL__ >= 706 +{-# LANGUAGE PolyKinds #-} +#endif #if __GLASGOW_HASKELL__ >= 702 && __GLASGOW_HASKELL__ < 710 {-# LANGUAGE Trustworthy #-} #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linear-1.20.5/src/Linear/V.hs new/linear-1.20.6/src/Linear/V.hs --- old/linear-1.20.5/src/Linear/V.hs 2016-05-29 17:58:12.000000000 +0200 +++ new/linear-1.20.6/src/Linear/V.hs 2017-04-27 04:21:14.000000000 +0200 @@ -2,6 +2,7 @@ {-# LANGUAGE KindSignatures #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE DefaultSignatures #-} {-# LANGUAGE Rank2Types #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE EmptyDataDecls #-} @@ -10,6 +11,8 @@ #if __GLASGOW_HASKELL__ >= 707 {-# LANGUAGE DataKinds #-} {-# LANGUAGE PolyKinds #-} +#endif +#if __GLASGOW_HASKELL__ >= 707 {-# LANGUAGE RoleAnnotations #-} #define USE_TYPE_LITS 1 #endif @@ -50,6 +53,10 @@ , reifyVectorNat #endif , fromVector +#if __GLASGOW_HASKELL__ >= 707 + , Finite(..) + , _V, _V' +#endif ) where #if __GLASGOW_HASKELL__ < 710 @@ -62,6 +69,9 @@ import Control.Lens as Lens import Data.Binary as Binary import Data.Bytes.Serial +#if __GLASGOW_HASKELL__ >= 707 +import Data.Complex +#endif import Data.Data import Data.Distributive import Data.Foldable as Foldable @@ -114,8 +124,30 @@ #if __GLASGOW_HASKELL__ >= 707 type role V nominal representational -#endif +class Finite v where + type Size (v :: * -> *) :: Nat -- this should allow kind k, for Reifies k Int + toV :: v a -> V (Size v) a + default toV :: Foldable v => v a -> V (Size v) a + toV = V . V.fromList . Foldable.toList + fromV :: V (Size v) a -> v a + +instance Finite Complex where + type Size Complex = 2 + toV (a :+ b) = V (V.fromListN 2 [a, b]) + fromV (V v) = (v V.! 0) :+ (v V.! 1) + +_V :: (Finite u, Finite v) => Iso (V (Size u) a) (V (Size v) b) (u a) (v b) +_V = iso fromV toV + +_V' :: Finite v => Iso (V (Size v) a) (V (Size v) b) (v a) (v b) +_V' = iso fromV toV + +instance Finite (V (n :: Nat)) where + type Size (V n) = n + toV = id + fromV = id +#endif newtype V n a = V { toVector :: V.Vector a } deriving (Eq,Ord,Show,Read,Typeable,NFData , Generic @@ -124,6 +156,7 @@ ,Generic1 #endif ) + dim :: forall n a. Dim n => V n a -> Int dim _ = reflectDim (Proxy :: Proxy n) {-# INLINE dim #-} @@ -158,7 +191,7 @@ reifyDim :: Int -> (forall (n :: *). Dim n => Proxy n -> r) -> r reifyDim i f = R.reify i (go f) where - go :: Reifies n Int => (Proxy (ReifiedDim n) -> a) -> proxy n -> a + go :: (Proxy (ReifiedDim n) -> a) -> proxy n -> a go g _ = g Proxy {-# INLINE reifyDim #-} @@ -217,7 +250,6 @@ {-# INLINE product #-} #endif - instance FoldableWithIndex Int (V n) where ifoldMap f (V as) = ifoldMap f as {-# INLINE ifoldMap #-} @@ -524,14 +556,14 @@ basicUnsafeRead (MV_VN _ v) i = liftM V $ V.generateM d (\j -> M.basicUnsafeRead v (d*i+j)) where d = reflectDim (Proxy :: Proxy n) - basicUnsafeWrite (MV_VN _ v0) i0 (V vn0) = let d0 = V.length vn0 in go v0 vn0 d0 (d0*i0) i0 + basicUnsafeWrite (MV_VN _ v0) i (V vn0) = let d0 = V.length vn0 in go v0 vn0 d0 (d0*i) 0 where - go v vn d o i - | i >= d = return () + go v vn d o j + | j >= d = return () | otherwise = do - a <- G.basicUnsafeIndexM vn i + a <- G.basicUnsafeIndexM vn j M.basicUnsafeWrite v o a - go v vn d (o+1) (i-1) + go v vn d (o+1) (j+1) #if MIN_VERSION_vector(0,11,0) basicInitialize (MV_VN _ v) = M.basicInitialize v {-# INLINE basicInitialize #-} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linear-1.20.5/src/Linear/V0.hs new/linear-1.20.6/src/Linear/V0.hs --- old/linear-1.20.5/src/Linear/V0.hs 2016-05-29 17:58:12.000000000 +0200 +++ new/linear-1.20.6/src/Linear/V0.hs 2017-04-27 04:21:14.000000000 +0200 @@ -4,11 +4,16 @@ {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702 + +#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE Trustworthy #-} #endif +#if __GLASGOW_HASKELL__ >= 707 +{-# LANGUAGE DataKinds #-} +#endif + #ifndef MIN_VERSION_hashable #define MIN_VERSION_hashable(x,y,z) 1 #endif @@ -54,11 +59,14 @@ import Data.Ix import Data.Semigroup import Data.Serialize -- cereal +#if __GLASGOW_HASKELL__ >= 707 +import qualified Data.Vector as V +#endif import Foreign.Storable (Storable(..)) #if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702 import GHC.Generics (Generic) #endif -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 706 +#if __GLASGOW_HASKELL__ >= 706 import GHC.Generics (Generic1) #endif import qualified Data.Vector.Generic.Mutable as M @@ -67,6 +75,9 @@ import Linear.Metric import Linear.Epsilon import Linear.Vector +#if __GLASGOW_HASKELL__ >= 707 +import Linear.V +#endif import Prelude hiding (sum) -- $setup @@ -89,6 +100,13 @@ #endif ) +#if __GLASGOW_HASKELL__ >= 707 +instance Finite V0 where + type Size V0 = 0 + toV _ = V V.empty + fromV _ = V0 +#endif + instance Serial1 V0 where serializeWith _ = serialize deserializeWith _ = deserialize diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linear-1.20.5/src/Linear/V1.hs new/linear-1.20.6/src/Linear/V1.hs --- old/linear-1.20.5/src/Linear/V1.hs 2016-05-29 17:58:12.000000000 +0200 +++ new/linear-1.20.6/src/Linear/V1.hs 2017-04-27 04:21:14.000000000 +0200 @@ -8,11 +8,13 @@ {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE ScopedTypeVariables #-} --- {-# OPTIONS_GHC -fno-warn-name-shadowing #-} -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702 +#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} {-# LANGUAGE DeriveGeneric #-} #endif +#if __GLASGOW_HASKELL__ >= 707 +{-# LANGUAGE DataKinds #-} +#endif #ifndef MIN_VERSION_hashable #define MIN_VERSION_hashable(x,y,z) 1 @@ -60,12 +62,16 @@ import Data.Functor.Rep import Data.Hashable import Data.Semigroup.Foldable +#if __GLASGOW_HASKELL__ >= 707 +import qualified Data.Vector as V +import Linear.V +#endif import Foreign.Storable (Storable) import GHC.Arr (Ix(..)) -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702 +#if __GLASGOW_HASKELL__ >= 702 import GHC.Generics (Generic) #endif -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 706 +#if __GLASGOW_HASKELL__ >= 706 import GHC.Generics (Generic1) #endif import Linear.Metric @@ -112,6 +118,13 @@ #endif ) +#if __GLASGOW_HASKELL__ >= 707 +instance Finite V1 where + type Size V1 = 1 + toV (V1 a) = V (V.singleton a) + fromV (V v) = V1 (v V.! 0) +#endif + instance Foldable1 V1 where foldMap1 f (V1 a) = f a {-# INLINE foldMap1 #-} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linear-1.20.5/src/Linear/V2.hs new/linear-1.20.6/src/Linear/V2.hs --- old/linear-1.20.5/src/Linear/V2.hs 2016-05-29 17:58:12.000000000 +0200 +++ new/linear-1.20.6/src/Linear/V2.hs 2017-04-27 04:21:14.000000000 +0200 @@ -4,12 +4,14 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE MultiParamTypeClasses #-} --- {-# OPTIONS_GHC -fno-warn-name-shadowing #-} {-# LANGUAGE CPP #-} -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702 +#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} {-# LANGUAGE DeriveGeneric #-} #endif +#if __GLASGOW_HASKELL__ >= 707 +{-# LANGUAGE DataKinds #-} +#endif #ifndef MIN_VERSION_vector #define MIN_VERSION_vector(x,y,z) 1 @@ -60,13 +62,16 @@ import Data.Semigroup import Data.Semigroup.Foldable import Data.Serialize as Cereal +#if __GLASGOW_HASKELL__ >= 707 +import qualified Data.Vector as V +#endif import Foreign.Ptr (castPtr) import Foreign.Storable (Storable(..)) import GHC.Arr (Ix(..)) -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702 +#if __GLASGOW_HASKELL__ >= 702 import GHC.Generics (Generic) #endif -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 706 +#if __GLASGOW_HASKELL__ >= 706 import GHC.Generics (Generic1) #endif import qualified Data.Vector.Generic.Mutable as M @@ -74,6 +79,9 @@ import qualified Data.Vector.Unboxed.Base as U import Linear.Metric import Linear.Epsilon +#if __GLASGOW_HASKELL__ >= 707 +import Linear.V +#endif import Linear.Vector import Linear.V1 (R1(..),ex) import Prelude hiding (sum) @@ -105,6 +113,13 @@ #endif ) +#if __GLASGOW_HASKELL__ >= 707 +instance Finite V2 where + type Size V2 = 2 + toV (V2 a b) = V (V.fromListN 2 [a,b]) + fromV (V v) = V2 (v V.! 0) (v V.! 1) +#endif + instance Functor V2 where fmap f (V2 a b) = V2 (f a) (f b) {-# INLINE fmap #-} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linear-1.20.5/src/Linear/V3.hs new/linear-1.20.6/src/Linear/V3.hs --- old/linear-1.20.5/src/Linear/V3.hs 2016-05-29 17:58:12.000000000 +0200 +++ new/linear-1.20.6/src/Linear/V3.hs 2017-04-27 04:21:14.000000000 +0200 @@ -5,10 +5,13 @@ {-# LANGUAGE RankNTypes #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE CPP #-} -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702 +#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} {-# LANGUAGE DeriveGeneric #-} #endif +#if __GLASGOW_HASKELL__ >= 707 +{-# LANGUAGE DataKinds #-} +#endif #ifndef MIN_VERSION_vector #define MIN_VERSION_vector(x,y,z) 1 @@ -59,20 +62,26 @@ import Data.Semigroup import Data.Semigroup.Foldable import Data.Serialize as Cereal -- cereal +#if __GLASGOW_HASKELL__ >= 707 +import qualified Data.Vector as V +#endif +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.Ptr (castPtr) import Foreign.Storable (Storable(..)) import GHC.Arr (Ix(..)) -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702 +#if __GLASGOW_HASKELL__ >= 702 import GHC.Generics (Generic) #endif -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 706 +#if __GLASGOW_HASKELL__ >= 706 import GHC.Generics (Generic1) #endif -import qualified Data.Vector.Generic.Mutable as M -import qualified Data.Vector.Generic as G -import qualified Data.Vector.Unboxed.Base as U import Linear.Epsilon import Linear.Metric +#if __GLASGOW_HASKELL__ >= 707 +import Linear.V +#endif import Linear.V2 import Linear.Vector @@ -80,14 +89,20 @@ -- | A 3-dimensional vector data V3 a = V3 !a !a !a deriving (Eq,Ord,Show,Read,Data,Typeable -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702 +#if __GLASGOW_HASKELL__ >= 702 ,Generic #endif -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 706 +#if __GLASGOW_HASKELL__ >= 706 ,Generic1 #endif ) +#if __GLASGOW_HASKELL__ >= 707 +instance Finite V3 where + type Size V3 = 3 + toV (V3 a b c) = V (V.fromListN 3 [a,b,c]) + fromV (V v) = V3 (v V.! 0) (v V.! 1) (v V.! 2) +#endif instance Functor V3 where fmap f (V3 a b c) = V3 (f a) (f b) (f c) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linear-1.20.5/src/Linear/V4.hs new/linear-1.20.6/src/Linear/V4.hs --- old/linear-1.20.5/src/Linear/V4.hs 2016-05-29 17:58:12.000000000 +0200 +++ new/linear-1.20.6/src/Linear/V4.hs 2017-04-27 04:21:14.000000000 +0200 @@ -5,10 +5,13 @@ {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE CPP #-} -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702 +#if __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Trustworthy #-} {-# LANGUAGE DeriveGeneric #-} #endif +#if __GLASGOW_HASKELL__ >= 707 +{-# LANGUAGE DataKinds #-} +#endif #ifndef MIN_VERSION_vector #define MIN_VERSION_vector(x,y,z) 1 @@ -65,20 +68,26 @@ import Data.Semigroup import Data.Semigroup.Foldable import Data.Serialize as Cereal +#if __GLASGOW_HASKELL__ >= 707 +import qualified Data.Vector as V +#endif +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.Ptr (castPtr) import Foreign.Storable (Storable(..)) import GHC.Arr (Ix(..)) -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702 +#if __GLASGOW_HASKELL__ >= 702 import GHC.Generics (Generic) #endif -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 706 +#if __GLASGOW_HASKELL__ >= 706 import GHC.Generics (Generic1) #endif -import qualified Data.Vector.Generic.Mutable as M -import qualified Data.Vector.Generic as G -import qualified Data.Vector.Unboxed.Base as U import Linear.Epsilon import Linear.Metric +#if __GLASGOW_HASKELL__ >= 707 +import Linear.V +#endif import Linear.V2 import Linear.V3 import Linear.Vector @@ -87,14 +96,21 @@ -- | A 4-dimensional vector. data V4 a = V4 !a !a !a !a deriving (Eq,Ord,Show,Read,Data,Typeable -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702 +#if __GLASGOW_HASKELL__ >= 702 ,Generic #endif -#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 706 +#if __GLASGOW_HASKELL__ >= 706 ,Generic1 #endif ) +#if __GLASGOW_HASKELL__ >= 707 +instance Finite V4 where + type Size V4 = 4 + toV (V4 a b c d) = V (V.fromListN 4 [a,b,c,d]) + fromV (V v) = V4 (v V.! 0) (v V.! 1) (v V.! 2) (v V.! 3) +#endif + instance Functor V4 where fmap f (V4 a b c d) = V4 (f a) (f b) (f c) (f d) {-# INLINE fmap #-} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linear-1.20.5/src/Linear/Vector.hs new/linear-1.20.6/src/Linear/Vector.hs --- old/linear-1.20.5/src/Linear/Vector.hs 2016-05-29 17:58:12.000000000 +0200 +++ new/linear-1.20.6/src/Linear/Vector.hs 2017-04-27 04:21:14.000000000 +0200 @@ -129,26 +129,15 @@ -- >>> V2 1 2 ^+^ V2 3 4 -- V2 4 6 (^+^) :: Num a => f a -> f a -> f a -#ifdef USE_GHC_GENERICS -#ifndef HLINT - default (^+^) :: Num a => f a -> f a -> f a (^+^) = liftU2 (+) {-# INLINE (^+^) #-} -#endif -#endif -- | Compute the difference between two vectors -- -- >>> V2 4 5 ^-^ V2 3 1 -- V2 1 4 (^-^) :: Num a => f a -> f a -> f a -#ifdef USE_GHC_GENERICS -#ifndef HLINT - default (^-^) :: Num a => f a -> f a -> f a x ^-^ y = x ^+^ negated y - {-# INLINE (^-^) #-} -#endif -#endif -- | Linearly interpolate between two vectors. lerp :: Num a => a -> f a -> f a -> f a @@ -190,12 +179,6 @@ {-# INLINE liftU2 #-} liftI2 = liftA2 {-# INLINE liftI2 #-} -#ifndef USE_GHC_GENERICS - (^+^) = liftU2 (+) - {-# INLINE (^+^) #-} - x ^-^ y = x ^+^ negated y - {-# INLINE (^-^) #-} -#endif instance Additive Vector where zero = mempty @@ -212,12 +195,6 @@ {-# INLINE liftU2 #-} liftI2 = Vector.zipWith {-# INLINE liftI2 #-} -#ifndef USE_GHC_GENERICS - (^+^) = liftU2 (+) - {-# INLINE (^+^) #-} - x ^-^ y = x ^+^ negated y - {-# INLINE (^-^) #-} -#endif instance Additive Maybe where zero = Nothing @@ -228,12 +205,6 @@ {-# INLINE liftU2 #-} liftI2 = liftA2 {-# INLINE liftI2 #-} -#ifndef USE_GHC_GENERICS - (^+^) = liftU2 (+) - {-# INLINE (^+^) #-} - x ^-^ y = x ^+^ negated y - {-# INLINE (^-^) #-} -#endif instance Additive [] where zero = [] @@ -245,12 +216,6 @@ {-# INLINE liftU2 #-} liftI2 = Prelude.zipWith {-# INLINE liftI2 #-} -#ifndef USE_GHC_GENERICS - (^+^) = liftU2 (+) - {-# INLINE (^+^) #-} - x ^-^ y = x ^+^ negated y - {-# INLINE (^-^) #-} -#endif instance Additive IntMap where zero = IntMap.empty @@ -259,12 +224,6 @@ {-# INLINE liftU2 #-} liftI2 = IntMap.intersectionWith {-# INLINE liftI2 #-} -#ifndef USE_GHC_GENERICS - (^+^) = liftU2 (+) - {-# INLINE (^+^) #-} - x ^-^ y = x ^+^ negated y - {-# INLINE (^-^) #-} -#endif instance Ord k => Additive (Map k) where zero = Map.empty @@ -273,12 +232,6 @@ {-# INLINE liftU2 #-} liftI2 = Map.intersectionWith {-# INLINE liftI2 #-} -#ifndef USE_GHC_GENERICS - (^+^) = liftU2 (+) - {-# INLINE (^+^) #-} - x ^-^ y = x ^+^ negated y - {-# INLINE (^-^) #-} -#endif instance (Eq k, Hashable k) => Additive (HashMap k) where zero = HashMap.empty @@ -287,12 +240,6 @@ {-# INLINE liftU2 #-} liftI2 = HashMap.intersectionWith {-# INLINE liftI2 #-} -#ifndef USE_GHC_GENERICS - (^+^) = liftU2 (+) - {-# INLINE (^+^) #-} - x ^-^ y = x ^+^ negated y - {-# INLINE (^-^) #-} -#endif instance Additive ((->) b) where zero = const 0 @@ -301,12 +248,6 @@ {-# INLINE liftU2 #-} liftI2 = liftA2 {-# INLINE liftI2 #-} -#ifndef USE_GHC_GENERICS - (^+^) = liftU2 (+) - {-# INLINE (^+^) #-} - x ^-^ y = x ^+^ negated y - {-# INLINE (^-^) #-} -#endif instance Additive Complex where zero = 0 :+ 0 @@ -315,12 +256,6 @@ {-# INLINE liftU2 #-} liftI2 f (a :+ b) (c :+ d) = f a c :+ f b d {-# INLINE liftI2 #-} -#ifndef USE_GHC_GENERICS - (^+^) = liftU2 (+) - {-# INLINE (^+^) #-} - x ^-^ y = x ^+^ negated y - {-# INLINE (^-^) #-} -#endif instance Additive Identity where zero = Identity 0 @@ -329,12 +264,6 @@ {-# INLINE liftU2 #-} liftI2 = liftA2 {-# INLINE liftI2 #-} -#ifndef USE_GHC_GENERICS - (^+^) = liftU2 (+) - {-# INLINE (^+^) #-} - x ^-^ y = x ^+^ negated y - {-# INLINE (^-^) #-} -#endif -- | Compute the negation of a vector -- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linear-1.20.5/tests/UnitTests.hs new/linear-1.20.6/tests/UnitTests.hs --- old/linear-1.20.5/tests/UnitTests.hs 2016-05-29 17:58:12.000000000 +0200 +++ new/linear-1.20.6/tests/UnitTests.hs 2017-04-27 04:21:14.000000000 +0200 @@ -1,12 +1,20 @@ +{-# LANGUAGE CPP #-} module Main (main) where import Test.Framework (defaultMain, testGroup, Test) import Test.Framework.Providers.HUnit import qualified Plucker import qualified Binary +#if __GLASGOW_HASKELL__ >= 707 +import qualified V +#endif tests :: [Test] -tests = [ testGroup "Plucker" $ hUnitTestToTests Plucker.tests - , testGroup "Binary" $ hUnitTestToTests Binary.tests ] +tests = [ testGroup "Plucker" $ hUnitTestToTests Plucker.tests + , testGroup "Binary" $ hUnitTestToTests Binary.tests +#if __GLASGOW_HASKELL__ >= 707 + , testGroup "V" $ hUnitTestToTests V.tests +#endif + ] main :: IO () main = defaultMain tests diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linear-1.20.5/tests/V.hs new/linear-1.20.6/tests/V.hs --- old/linear-1.20.5/tests/V.hs 1970-01-01 01:00:00.000000000 +0100 +++ new/linear-1.20.6/tests/V.hs 2017-04-27 04:21:14.000000000 +0200 @@ -0,0 +1,13 @@ +{-# LANGUAGE DataKinds #-} +module V (tests) where + +import Control.DeepSeq (rnf) +import qualified Data.Vector.Unboxed as U (fromList) +import Linear.V (V) +import Test.HUnit + +v10 :: V 10 Int +v10 = return 5 + +tests :: Test +tests = test [ "GH124" ~: rnf (U.fromList [v10]) ~?= () ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linear-1.20.5/tests/doctests.hs new/linear-1.20.6/tests/doctests.hs --- old/linear-1.20.5/tests/doctests.hs 2016-05-29 17:58:12.000000000 +0200 +++ new/linear-1.20.6/tests/doctests.hs 2017-04-27 04:21:14.000000000 +0200 @@ -1,30 +1,25 @@ +----------------------------------------------------------------------------- +-- | +-- Module : Main (doctests) +-- Copyright : (C) 2012-14 Edward Kmett +-- License : BSD-style (see the file LICENSE) +-- Maintainer : Edward Kmett <[email protected]> +-- 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 +----------------------------------------------------------------------------- module Main where -import Build_doctests (autogen_dir, deps) -import Control.Applicative -import Control.Monad -import Data.List -import System.Directory -import System.FilePath +import Build_doctests (flags, pkgs, module_sources) +import Data.Foldable (traverse_) import Test.DocTest main :: IO () -main = getSources >>= \sources -> doctest $ - "-isrc" - : ("-i" ++ autogen_dir) - : "-optP-include" - : ("-optP" ++ autogen_dir ++ "/cabal_macros.h") - : "-hide-all-packages" - : map ("-package="++) deps ++ sources - -getSources :: IO [FilePath] -getSources = filter (isSuffixOf ".hs") <$> go "src" +main = do + traverse_ putStrLn args + doctest args where - go dir = do - (dirs, files) <- getFilesAndDirectories dir - (files ++) . concat <$> mapM go dirs - -getFilesAndDirectories :: FilePath -> IO ([FilePath], [FilePath]) -getFilesAndDirectories dir = do - c <- map (dir </>) . filter (`notElem` ["..", "."]) <$> getDirectoryContents dir - (,) <$> filterM doesDirectoryExist c <*> filterM doesFileExist c + args = flags ++ pkgs ++ module_sources
