diff options
author | Hiromi ISHII <konn.jinro@gmail.com> | 2017-12-25 20:23:13 +0900 |
---|---|---|
committer | Hiromi ISHII <konn.jinro@gmail.com> | 2017-12-25 20:23:13 +0900 |
commit | e83e2023da77ecaa9aaba15bc9bd48757f73b3a9 (patch) | |
tree | f7aae740fa7129c4641cf05a9e00260e48cd92bb /packages | |
parent | 87c7682bbfd17308749d5e9568f1ffa25390ce79 (diff) |
Workaround for GHC-8.4.x
* Adds missing Semigroup instances
* Adds `semigroups` to the deps of `hmatrix`
* Hides conflicting names from import list with base >= 4.11
* `(Prelude.<>)` and `GHC.TypeNats.Mod`
Diffstat (limited to 'packages')
-rw-r--r-- | packages/base/hmatrix.cabal | 1 | ||||
-rw-r--r-- | packages/base/src/Internal/Container.hs | 5 | ||||
-rw-r--r-- | packages/base/src/Internal/Convolution.hs | 4 | ||||
-rw-r--r-- | packages/base/src/Internal/Modular.hs | 8 | ||||
-rw-r--r-- | packages/base/src/Internal/Util.hs | 4 | ||||
-rw-r--r-- | packages/base/src/Numeric/LinearAlgebra.hs | 4 | ||||
-rw-r--r-- | packages/base/src/Numeric/LinearAlgebra/HMatrix.hs | 4 | ||||
-rw-r--r-- | packages/base/src/Numeric/LinearAlgebra/Static.hs | 4 | ||||
-rw-r--r-- | packages/base/src/Numeric/Matrix.hs | 8 | ||||
-rw-r--r-- | packages/gsl/src/Numeric/GSL/Fitting.hs | 4 | ||||
-rw-r--r-- | packages/gsl/src/Numeric/GSL/Random.hs | 5 | ||||
-rw-r--r-- | packages/tests/src/Numeric/LinearAlgebra/Tests.hs | 4 | ||||
-rw-r--r-- | packages/tests/src/Numeric/LinearAlgebra/Tests/Instances.hs | 6 | ||||
-rw-r--r-- | packages/tests/src/Numeric/LinearAlgebra/Tests/Properties.hs | 4 |
14 files changed, 61 insertions, 4 deletions
diff --git a/packages/base/hmatrix.cabal b/packages/base/hmatrix.cabal index 9d03f2b..ab3fff8 100644 --- a/packages/base/hmatrix.cabal +++ b/packages/base/hmatrix.cabal | |||
@@ -46,6 +46,7 @@ library | |||
46 | split, | 46 | split, |
47 | bytestring, | 47 | bytestring, |
48 | storable-complex, | 48 | storable-complex, |
49 | semigroups, | ||
49 | vector >= 0.8 | 50 | vector >= 0.8 |
50 | 51 | ||
51 | hs-source-dirs: src | 52 | hs-source-dirs: src |
diff --git a/packages/base/src/Internal/Container.hs b/packages/base/src/Internal/Container.hs index b379530..1520489 100644 --- a/packages/base/src/Internal/Container.hs +++ b/packages/base/src/Internal/Container.hs | |||
@@ -1,3 +1,4 @@ | |||
1 | {-# LANGUAGE CPP #-} | ||
1 | {-# LANGUAGE FlexibleContexts #-} | 2 | {-# LANGUAGE FlexibleContexts #-} |
2 | {-# LANGUAGE FlexibleInstances #-} | 3 | {-# LANGUAGE FlexibleInstances #-} |
3 | {-# LANGUAGE MultiParamTypeClasses #-} | 4 | {-# LANGUAGE MultiParamTypeClasses #-} |
@@ -29,7 +30,9 @@ import Internal.Matrix | |||
29 | import Internal.Element | 30 | import Internal.Element |
30 | import Internal.Numeric | 31 | import Internal.Numeric |
31 | import Internal.Algorithms(Field,linearSolveSVD,Herm,mTm) | 32 | import Internal.Algorithms(Field,linearSolveSVD,Herm,mTm) |
32 | 33 | #if MIN_VERSION_base(4,11,0) | |
34 | import Prelude hiding ((<>)) | ||
35 | #endif | ||
33 | ------------------------------------------------------------------ | 36 | ------------------------------------------------------------------ |
34 | 37 | ||
35 | {- | Creates a real vector containing a range of values: | 38 | {- | Creates a real vector containing a range of values: |
diff --git a/packages/base/src/Internal/Convolution.hs b/packages/base/src/Internal/Convolution.hs index 384fdf8..004e1ff 100644 --- a/packages/base/src/Internal/Convolution.hs +++ b/packages/base/src/Internal/Convolution.hs | |||
@@ -1,3 +1,4 @@ | |||
1 | {-# LANGUAGE CPP #-} | ||
1 | {-# LANGUAGE FlexibleContexts #-} | 2 | {-# LANGUAGE FlexibleContexts #-} |
2 | ----------------------------------------------------------------------------- | 3 | ----------------------------------------------------------------------------- |
3 | {- | | 4 | {- | |
@@ -23,6 +24,9 @@ import Internal.Numeric | |||
23 | import Internal.Element | 24 | import Internal.Element |
24 | import Internal.Conversion | 25 | import Internal.Conversion |
25 | import Internal.Container | 26 | import Internal.Container |
27 | #if MIN_VERSION_base(4,11,0) | ||
28 | import Prelude hiding ((<>)) | ||
29 | #endif | ||
26 | 30 | ||
27 | 31 | ||
28 | vectSS :: Element t => Int -> Vector t -> Matrix t | 32 | vectSS :: Element t => Int -> Vector t -> Matrix t |
diff --git a/packages/base/src/Internal/Modular.hs b/packages/base/src/Internal/Modular.hs index f3c59a8..9d51444 100644 --- a/packages/base/src/Internal/Modular.hs +++ b/packages/base/src/Internal/Modular.hs | |||
@@ -1,3 +1,4 @@ | |||
1 | {-# LANGUAGE CPP #-} | ||
1 | {-# LANGUAGE DataKinds #-} | 2 | {-# LANGUAGE DataKinds #-} |
2 | {-# LANGUAGE KindSignatures #-} | 3 | {-# LANGUAGE KindSignatures #-} |
3 | {-# LANGUAGE GeneralizedNewtypeDeriving #-} | 4 | {-# LANGUAGE GeneralizedNewtypeDeriving #-} |
@@ -38,13 +39,20 @@ import Internal.Util(Normed(..),Indexable(..), | |||
38 | gaussElim, gaussElim_1, gaussElim_2, | 39 | gaussElim, gaussElim_1, gaussElim_2, |
39 | luST, luSolve', luPacked', magnit, invershur) | 40 | luST, luSolve', luPacked', magnit, invershur) |
40 | import Internal.ST(mutable) | 41 | import Internal.ST(mutable) |
42 | #if MIN_VERSION_base(4,11,0) | ||
43 | import GHC.TypeLits hiding (Mod) | ||
44 | #else | ||
41 | import GHC.TypeLits | 45 | import GHC.TypeLits |
46 | #endif | ||
42 | import Data.Proxy(Proxy) | 47 | import Data.Proxy(Proxy) |
43 | import Foreign.ForeignPtr(castForeignPtr) | 48 | import Foreign.ForeignPtr(castForeignPtr) |
44 | import Foreign.Storable | 49 | import Foreign.Storable |
45 | import Data.Ratio | 50 | import Data.Ratio |
46 | import Data.Complex | 51 | import Data.Complex |
47 | import Control.DeepSeq ( NFData(..) ) | 52 | import Control.DeepSeq ( NFData(..) ) |
53 | #if MIN_VERSION_base(4,11,0) | ||
54 | import Prelude hiding ((<>)) | ||
55 | #endif | ||
48 | 56 | ||
49 | 57 | ||
50 | 58 | ||
diff --git a/packages/base/src/Internal/Util.hs b/packages/base/src/Internal/Util.hs index ec21fe4..8c8a31e 100644 --- a/packages/base/src/Internal/Util.hs +++ b/packages/base/src/Internal/Util.hs | |||
@@ -1,3 +1,4 @@ | |||
1 | {-# LANGUAGE CPP #-} | ||
1 | {-# LANGUAGE FlexibleContexts #-} | 2 | {-# LANGUAGE FlexibleContexts #-} |
2 | {-# LANGUAGE FlexibleInstances #-} | 3 | {-# LANGUAGE FlexibleInstances #-} |
3 | {-# LANGUAGE MultiParamTypeClasses #-} | 4 | {-# LANGUAGE MultiParamTypeClasses #-} |
@@ -80,6 +81,9 @@ import Control.Arrow((&&&),(***)) | |||
80 | import Data.Complex | 81 | import Data.Complex |
81 | import Data.Function(on) | 82 | import Data.Function(on) |
82 | import Internal.ST | 83 | import Internal.ST |
84 | #if MIN_VERSION_base(4,11,0) | ||
85 | import Prelude hiding ((<>)) | ||
86 | #endif | ||
83 | 87 | ||
84 | type ℝ = Double | 88 | type ℝ = Double |
85 | type ℕ = Int | 89 | type ℕ = Int |
diff --git a/packages/base/src/Numeric/LinearAlgebra.hs b/packages/base/src/Numeric/LinearAlgebra.hs index fd100e0..73d4a13 100644 --- a/packages/base/src/Numeric/LinearAlgebra.hs +++ b/packages/base/src/Numeric/LinearAlgebra.hs | |||
@@ -1,3 +1,4 @@ | |||
1 | {-# LANGUAGE CPP #-} | ||
1 | {-# LANGUAGE FlexibleContexts #-} | 2 | {-# LANGUAGE FlexibleContexts #-} |
2 | 3 | ||
3 | ----------------------------------------------------------------------------- | 4 | ----------------------------------------------------------------------------- |
@@ -190,6 +191,9 @@ import Internal.Random | |||
190 | import Internal.Sparse((!#>)) | 191 | import Internal.Sparse((!#>)) |
191 | import Internal.CG | 192 | import Internal.CG |
192 | import Internal.Conversion | 193 | import Internal.Conversion |
194 | #if MIN_VERSION_base(4,11,0) | ||
195 | import Prelude hiding ((<>)) | ||
196 | #endif | ||
193 | 197 | ||
194 | {- | dense matrix product | 198 | {- | dense matrix product |
195 | 199 | ||
diff --git a/packages/base/src/Numeric/LinearAlgebra/HMatrix.hs b/packages/base/src/Numeric/LinearAlgebra/HMatrix.hs index 5ce529c..3a84645 100644 --- a/packages/base/src/Numeric/LinearAlgebra/HMatrix.hs +++ b/packages/base/src/Numeric/LinearAlgebra/HMatrix.hs | |||
@@ -1,3 +1,4 @@ | |||
1 | {-# LANGUAGE CPP #-} | ||
1 | -------------------------------------------------------------------------------- | 2 | -------------------------------------------------------------------------------- |
2 | {- | | 3 | {- | |
3 | Module : Numeric.LinearAlgebra.HMatrix | 4 | Module : Numeric.LinearAlgebra.HMatrix |
@@ -19,6 +20,9 @@ module Numeric.LinearAlgebra.HMatrix ( | |||
19 | import Numeric.LinearAlgebra | 20 | import Numeric.LinearAlgebra |
20 | import Internal.Util | 21 | import Internal.Util |
21 | import Internal.Algorithms(cholSH, mbCholSH, eigSH', eigenvaluesSH', geigSH') | 22 | import Internal.Algorithms(cholSH, mbCholSH, eigSH', eigenvaluesSH', geigSH') |
23 | #if MIN_VERSION_base(4,11,0) | ||
24 | import Prelude hiding ((<>)) | ||
25 | #endif | ||
22 | 26 | ||
23 | infixr 8 <·> | 27 | infixr 8 <·> |
24 | (<·>) :: Numeric t => Vector t -> Vector t -> t | 28 | (<·>) :: Numeric t => Vector t -> Vector t -> t |
diff --git a/packages/base/src/Numeric/LinearAlgebra/Static.hs b/packages/base/src/Numeric/LinearAlgebra/Static.hs index 3000dcb..e328904 100644 --- a/packages/base/src/Numeric/LinearAlgebra/Static.hs +++ b/packages/base/src/Numeric/LinearAlgebra/Static.hs | |||
@@ -1,3 +1,4 @@ | |||
1 | {-# LANGUAGE CPP #-} | ||
1 | {-# LANGUAGE DataKinds #-} | 2 | {-# LANGUAGE DataKinds #-} |
2 | {-# LANGUAGE KindSignatures #-} | 3 | {-# LANGUAGE KindSignatures #-} |
3 | {-# LANGUAGE GeneralizedNewtypeDeriving #-} | 4 | {-# LANGUAGE GeneralizedNewtypeDeriving #-} |
@@ -80,6 +81,9 @@ import Control.Arrow((***)) | |||
80 | import Text.Printf | 81 | import Text.Printf |
81 | import Data.Type.Equality ((:~:)(Refl)) | 82 | import Data.Type.Equality ((:~:)(Refl)) |
82 | import qualified Data.Bifunctor as BF (first) | 83 | import qualified Data.Bifunctor as BF (first) |
84 | #if MIN_VERSION_base(4,11,0) | ||
85 | import Prelude hiding ((<>)) | ||
86 | #endif | ||
83 | 87 | ||
84 | ud1 :: R n -> Vector ℝ | 88 | ud1 :: R n -> Vector ℝ |
85 | ud1 (R (Dim v)) = v | 89 | ud1 (R (Dim v)) = v |
diff --git a/packages/base/src/Numeric/Matrix.hs b/packages/base/src/Numeric/Matrix.hs index 5400f26..06da150 100644 --- a/packages/base/src/Numeric/Matrix.hs +++ b/packages/base/src/Numeric/Matrix.hs | |||
@@ -32,8 +32,11 @@ import Internal.Element | |||
32 | import Internal.Numeric | 32 | import Internal.Numeric |
33 | import qualified Data.Monoid as M | 33 | import qualified Data.Monoid as M |
34 | import Data.List(partition) | 34 | import Data.List(partition) |
35 | import qualified Data.Foldable as F | ||
36 | import qualified Data.Semigroup as S | ||
35 | import Internal.Chain | 37 | import Internal.Chain |
36 | 38 | ||
39 | |||
37 | ------------------------------------------------------------------- | 40 | ------------------------------------------------------------------- |
38 | 41 | ||
39 | instance Container Matrix a => Eq (Matrix a) where | 42 | instance Container Matrix a => Eq (Matrix a) where |
@@ -84,6 +87,11 @@ adaptScalarM f1 f2 f3 x y | |||
84 | | isScalar y = f3 x (y @@>(0,0) ) | 87 | | isScalar y = f3 x (y @@>(0,0) ) |
85 | | otherwise = f2 x y | 88 | | otherwise = f2 x y |
86 | 89 | ||
90 | instance (Container Vector t, Eq t, Num (Vector t), Product t) => S.Semigroup (Matrix t) | ||
91 | where | ||
92 | (<>) = mappend | ||
93 | sconcat = mconcat . F.toList | ||
94 | |||
87 | instance (Container Vector t, Eq t, Num (Vector t), Product t) => M.Monoid (Matrix t) | 95 | instance (Container Vector t, Eq t, Num (Vector t), Product t) => M.Monoid (Matrix t) |
88 | where | 96 | where |
89 | mempty = 1 | 97 | mempty = 1 |
diff --git a/packages/gsl/src/Numeric/GSL/Fitting.hs b/packages/gsl/src/Numeric/GSL/Fitting.hs index 9a2f665..8f2eae3 100644 --- a/packages/gsl/src/Numeric/GSL/Fitting.hs +++ b/packages/gsl/src/Numeric/GSL/Fitting.hs | |||
@@ -1,3 +1,4 @@ | |||
1 | {-# LANGUAGE CPP #-} | ||
1 | {-# LANGUAGE FlexibleContexts #-} | 2 | {-# LANGUAGE FlexibleContexts #-} |
2 | 3 | ||
3 | {- | | 4 | {- | |
@@ -58,6 +59,9 @@ import Numeric.GSL.Internal | |||
58 | import Foreign.Ptr(FunPtr, freeHaskellFunPtr) | 59 | import Foreign.Ptr(FunPtr, freeHaskellFunPtr) |
59 | import Foreign.C.Types | 60 | import Foreign.C.Types |
60 | import System.IO.Unsafe(unsafePerformIO) | 61 | import System.IO.Unsafe(unsafePerformIO) |
62 | #if MIN_VERSION_base(4,11,0) | ||
63 | import Prelude hiding ((<>)) | ||
64 | #endif | ||
61 | 65 | ||
62 | ------------------------------------------------------------------------- | 66 | ------------------------------------------------------------------------- |
63 | 67 | ||
diff --git a/packages/gsl/src/Numeric/GSL/Random.hs b/packages/gsl/src/Numeric/GSL/Random.hs index aad9ad9..20a6c31 100644 --- a/packages/gsl/src/Numeric/GSL/Random.hs +++ b/packages/gsl/src/Numeric/GSL/Random.hs | |||
@@ -1,3 +1,4 @@ | |||
1 | {-# LANGUAGE CPP #-} | ||
1 | ----------------------------------------------------------------------------- | 2 | ----------------------------------------------------------------------------- |
2 | -- | | 3 | -- | |
3 | -- Module : Numeric.GSL.Random | 4 | -- Module : Numeric.GSL.Random |
@@ -30,7 +31,9 @@ import Numeric.LinearAlgebra.HMatrix hiding ( | |||
30 | randn | 31 | randn |
31 | ) | 32 | ) |
32 | import System.Random(randomIO) | 33 | import System.Random(randomIO) |
33 | 34 | #if MIN_VERSION_base(4,11,0) | |
35 | import Prelude hiding ((<>)) | ||
36 | #endif | ||
34 | 37 | ||
35 | type Seed = Int | 38 | type Seed = Int |
36 | 39 | ||
diff --git a/packages/tests/src/Numeric/LinearAlgebra/Tests.hs b/packages/tests/src/Numeric/LinearAlgebra/Tests.hs index 6d54f4d..2aefc87 100644 --- a/packages/tests/src/Numeric/LinearAlgebra/Tests.hs +++ b/packages/tests/src/Numeric/LinearAlgebra/Tests.hs | |||
@@ -39,7 +39,11 @@ import Numeric.LinearAlgebra.Tests.Properties | |||
39 | import Test.HUnit hiding ((~:),test,Testable,State) | 39 | import Test.HUnit hiding ((~:),test,Testable,State) |
40 | import System.Info | 40 | import System.Info |
41 | import Data.List(foldl1') | 41 | import Data.List(foldl1') |
42 | #if MIN_VERSION_base(4,11,0) | ||
43 | import Prelude hiding ((^),(<>)) | ||
44 | #else | ||
42 | import Prelude hiding ((^)) | 45 | import Prelude hiding ((^)) |
46 | #endif | ||
43 | import qualified Prelude | 47 | import qualified Prelude |
44 | import System.CPUTime | 48 | import System.CPUTime |
45 | import System.Exit | 49 | import System.Exit |
diff --git a/packages/tests/src/Numeric/LinearAlgebra/Tests/Instances.hs b/packages/tests/src/Numeric/LinearAlgebra/Tests/Instances.hs index 37f7da2..f0bddd0 100644 --- a/packages/tests/src/Numeric/LinearAlgebra/Tests/Instances.hs +++ b/packages/tests/src/Numeric/LinearAlgebra/Tests/Instances.hs | |||
@@ -1,4 +1,4 @@ | |||
1 | {-# LANGUAGE FlexibleContexts, UndecidableInstances, FlexibleInstances, ScopedTypeVariables #-} | 1 | {-# LANGUAGE CPP, FlexibleContexts, UndecidableInstances, FlexibleInstances, ScopedTypeVariables #-} |
2 | ----------------------------------------------------------------------------- | 2 | ----------------------------------------------------------------------------- |
3 | {- | | 3 | {- | |
4 | Module : Numeric.LinearAlgebra.Tests.Instances | 4 | Module : Numeric.LinearAlgebra.Tests.Instances |
@@ -32,7 +32,9 @@ import Test.QuickCheck(Arbitrary,arbitrary,choose,vector,sized,shrink) | |||
32 | import GHC.TypeLits | 32 | import GHC.TypeLits |
33 | import Data.Proxy (Proxy(..)) | 33 | import Data.Proxy (Proxy(..)) |
34 | import qualified Numeric.LinearAlgebra.Static as Static | 34 | import qualified Numeric.LinearAlgebra.Static as Static |
35 | 35 | #if MIN_VERSION_base(4,11,0) | |
36 | import Prelude hiding ((<>)) | ||
37 | #endif | ||
36 | 38 | ||
37 | shrinkListElementwise :: (Arbitrary a) => [a] -> [[a]] | 39 | shrinkListElementwise :: (Arbitrary a) => [a] -> [[a]] |
38 | shrinkListElementwise [] = [] | 40 | shrinkListElementwise [] = [] |
diff --git a/packages/tests/src/Numeric/LinearAlgebra/Tests/Properties.hs b/packages/tests/src/Numeric/LinearAlgebra/Tests/Properties.hs index 0de9f37..e3a6242 100644 --- a/packages/tests/src/Numeric/LinearAlgebra/Tests/Properties.hs +++ b/packages/tests/src/Numeric/LinearAlgebra/Tests/Properties.hs | |||
@@ -1,3 +1,4 @@ | |||
1 | {-# LANGUAGE CPP #-} | ||
1 | {-# LANGUAGE FlexibleContexts #-} | 2 | {-# LANGUAGE FlexibleContexts #-} |
2 | {-# LANGUAGE TypeFamilies #-} | 3 | {-# LANGUAGE TypeFamilies #-} |
3 | {-# LANGUAGE DataKinds #-} | 4 | {-# LANGUAGE DataKinds #-} |
@@ -58,6 +59,9 @@ import Data.Binary | |||
58 | import Data.Binary.Get (runGet) | 59 | import Data.Binary.Get (runGet) |
59 | import Data.Either (isLeft) | 60 | import Data.Either (isLeft) |
60 | import Debug.Trace (traceShowId) | 61 | import Debug.Trace (traceShowId) |
62 | #if MIN_VERSION_base(4,11,0) | ||
63 | import Prelude hiding ((<>)) | ||
64 | #endif | ||
61 | 65 | ||
62 | (~=) :: Double -> Double -> Bool | 66 | (~=) :: Double -> Double -> Bool |
63 | a ~= b = abs (a - b) < 1e-10 | 67 | a ~= b = abs (a - b) < 1e-10 |