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/base/src/Numeric/Matrix.hs | |
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/base/src/Numeric/Matrix.hs')
-rw-r--r-- | packages/base/src/Numeric/Matrix.hs | 8 |
1 files changed, 8 insertions, 0 deletions
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 |