bitset 1.4.4 → 1.4.5
raw patch · 4 files changed
+22/−10 lines, 4 filessetup-changedPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Data.BitSet.Generic: instance Eq (GBitSet c a)
- Data.BitSet.Generic: instance Ord (GBitSet c a)
+ Data.BitSet.Generic: instance Eq c => Eq (GBitSet c a)
+ Data.BitSet.Generic: instance Ord c => Ord (GBitSet c a)
Files
- CHANGES +8/−1
- Setup.hs +3/−2
- bitset.cabal +1/−1
- src/Data/BitSet/Generic.hs +10/−6
CHANGES view
@@ -3,12 +3,19 @@ Here you can see the full list of changes between each bitset release. +Version 1.4.5+-------------++Released on June 6th, 2013++- Fixed 'Ord' instance, same bug as in 'Eq'. Where is my mind?+ Version 1.4.4 ------------- Released on May 14th, 2013 -- Fixed bug with wrong Eq instance.+- Fixed 'Eq' instance, equal sizes don't mean a thing! Version 1.4.3 -------------
Setup.hs view
@@ -1,4 +1,5 @@ #!/usr/bin/env runhaskell+ {-# LANGUAGE NamedFieldPuns #-} {-# OPTIONS_GHC -Wall -Werror #-} @@ -11,7 +12,7 @@ import Distribution.Simple.LocalBuildInfo (LocalBuildInfo(..)) import Distribution.Simple.Program (gccProgram, lookupProgram, runProgram) import Distribution.Simple.Setup (BuildFlags)-import Distribution.Simple.Utils (die, rawSystemStdout, writeFileAtomic)+import Distribution.Simple.Utils (die, rawSystemStdout) import Distribution.Verbosity (silent) main :: IO ()@@ -30,7 +31,7 @@ runProgram silent gcc ["bin" </> "mkDerivedGmpConstants.c", "-o", path] output <- rawSystemStdout silent path []- writeFileAtomic ("cbits" </> "GmpDerivedConstants.h") output+ writeFile ("cbits" </> "GmpDerivedConstants.h") output removeFile path buildHook simpleUserHooks pkg_descr lbi userHooks flags Nothing -> die "Failed to find GCC!"
bitset.cabal view
@@ -1,5 +1,5 @@ Name: bitset-Version: 1.4.4+Version: 1.4.5 Synopsis: A space-efficient set data structure. Description: A /bit set/ is a compact data structure, which maintains a set of members
src/Data/BitSet/Generic.hs view
@@ -84,7 +84,6 @@ import Data.Bits (Bits, (.|.), (.&.), complement, bit, testBit, setBit, clearBit, popCount) import Data.Data (Typeable)-import Data.Function (on) import Data.Monoid (Monoid(..), (<>)) import Foreign (Storable(..), castPtr) import GHC.Exts (build)@@ -100,11 +99,15 @@ } deriving Typeable -instance Eq (GBitSet c a) where- BitSet n1 b1 == BitSet n2 b2 = n1 == n2 && b1 == b2+instance Eq c => Eq (GBitSet c a) where+ BitSet { _n = n1, _bits = b1 } == BitSet { _n = n2, _bits = b2 } =+ n1 == n2 && b1 == b2 -instance Ord (GBitSet c a) where- compare = compare `on` _n+instance Ord c => Ord (GBitSet c a) where+ BitSet { _n = n1, _bits = b1 } `compare` BitSet { _n = n2, _bits = b2 } =+ case compare n1 n2 of+ EQ -> compare b1 b2+ res -> res instance (Enum a, Read a, Bits c, Num c) => Read (GBitSet c a) where readPrec = parens . prec 10 $ do@@ -144,7 +147,8 @@ -- | /O(1)/. Is the bit set empty? null :: GBitSet c a -> Bool-null (BitSet { _bits }) = _bits == 0+null (BitSet { _n = 0, _bits = 0 }) = True+null _bs = False {-# INLINE null #-} -- | /O(1)/. The number of elements in the bit set.