opentheory-primitive 1.5 → 1.6
raw patch · 3 files changed
+12/−2 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ OpenTheory.Primitive.Natural: instance Read Natural
Files
- opentheory-primitive.cabal +1/−1
- src/OpenTheory/Primitive/Natural.hs +7/−0
- src/OpenTheory/Primitive/Test.hs +4/−1
opentheory-primitive.cabal view
@@ -1,5 +1,5 @@ name: opentheory-primitive-version: 1.5+version: 1.6 category: Formal Methods synopsis: Haskell primitives used by OpenTheory packages license: MIT
src/OpenTheory/Primitive/Natural.hs view
@@ -14,6 +14,7 @@ where import Data.Bits+import qualified Data.Maybe as Maybe import qualified Test.QuickCheck newtype Natural =@@ -75,6 +76,12 @@ in (Natural q, Natural r) toInteger = unNatural++instance Read Natural where+ readsPrec =+ \p -> Maybe.mapMaybe f . readsPrec p+ where+ f (n,s) = if n < 0 then Nothing else Just (Natural n, s) instance Data.Bits.Bits Natural where x .&. y = Natural (unNatural x .&. unNatural y)
src/OpenTheory/Primitive/Test.hs view
@@ -30,4 +30,7 @@ check :: Testable prop => String -> prop -> IO () check desc prop = do putStr desc- Test.QuickCheck.quickCheckWith checkArgs prop+ res <- Test.QuickCheck.quickCheckWithResult checkArgs prop+ case res of+ Test.QuickCheck.Failure {} -> error "Proposition failed"+ _ -> return ()