summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md3
-rw-r--r--LICENSE3
-rw-r--r--boltzmann-samplers.cabal12
-rw-r--r--src/Boltzmann/Data/Oracle.hs11
4 files changed, 21 insertions, 8 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..7c75966
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,3 @@
+# 0.1.1.0
+
+- Added Semigroup Nat instance, for compatibility with GHC 8.4
diff --git a/LICENSE b/LICENSE
index eebc804..e54a9dc 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,5 +1,4 @@
Copyright 2017 Li-yao Xia
-Copyright 2017 Li-yao Xia
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
@@ -17,4 +16,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE. \ No newline at end of file
+SOFTWARE.
diff --git a/boltzmann-samplers.cabal b/boltzmann-samplers.cabal
index 8e3a5f7..076c032 100644
--- a/boltzmann-samplers.cabal
+++ b/boltzmann-samplers.cabal
@@ -1,5 +1,5 @@
name: boltzmann-samplers
-version: 0.1.0.0
+version: 0.1.1.0
synopsis: Uniform random generators
description:
@@ -16,8 +16,11 @@ author: Li-yao Xia
maintainer: lysxia@gmail.com
category: Data, Generic, Random
build-type: Simple
-extra-source-files: README.md
+extra-source-files:
+ README.md
+ CHANGELOG.md
cabal-version: >=1.10
+tested-with: GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC == 8.4.1
flag test
Description:
@@ -38,7 +41,7 @@ library
Boltzmann.Species
build-depends:
ad,
- base >= 4.9 && < 5,
+ base >= 4.8 && < 5,
containers,
hashable,
hmatrix,
@@ -49,6 +52,9 @@ library
QuickCheck,
transformers,
vector
+ if impl(ghc < 8.0)
+ build-depends:
+ semigroups
default-language: Haskell2010
source-repository head
diff --git a/src/Boltzmann/Data/Oracle.hs b/src/Boltzmann/Data/Oracle.hs
index 63fbd84..8730822 100644
--- a/src/Boltzmann/Data/Oracle.hs
+++ b/src/Boltzmann/Data/Oracle.hs
@@ -21,10 +21,12 @@ import Data.Hashable ( Hashable )
import Data.HashMap.Lazy ( HashMap )
import qualified Data.HashMap.Lazy as HashMap
import Data.Maybe ( fromJust, isJust )
-import Data.Monoid
+import Data.Monoid hiding ((<>))
+import Data.Semigroup
import qualified Data.Vector as V
import GHC.Generics ( Generic )
import Numeric.AD
+
import Boltzmann.Data.Common
import Boltzmann.Data.Types
import Boltzmann.Solver
@@ -97,10 +99,13 @@ type Ix = Int
data Nat = Zero | Succ Nat
deriving (Eq, Ord, Show)
+instance Semigroup Nat where
+ (<>) (Succ n) = Succ . (<>) n
+ (<>) Zero = id
+
instance Monoid Nat where
mempty = Zero
- mappend (Succ n) = Succ . mappend n
- mappend Zero = id
+ mappend = (<>)
natToInt :: Nat -> Int
natToInt Zero = 0