disjoint-containers 0.2.0 → 0.2.1
raw patch · 3 files changed
+20/−4 lines, 3 filesdep ~containersPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: containers
API changes (from Hackage documentation)
Files
- disjoint-containers.cabal +2/−2
- src/Data/DisjointMap.hs +9/−1
- src/Data/DisjointSet.hs +9/−1
disjoint-containers.cabal view
@@ -1,5 +1,5 @@ name: disjoint-containers-version: 0.2.0+version: 0.2.1 synopsis: Disjoint containers description: Disjoint containers homepage: https://github.com/andrewthad/disjoint-containers#readme@@ -21,7 +21,7 @@ build-depends: base >= 4.7 && < 5 , transformers >= 0.5 && < 0.6- , containers >= 0.5.10 && < 0.6+ , containers >= 0.5 && < 0.6 default-language: Haskell2010 test-suite test
src/Data/DisjointMap.hs view
@@ -2,6 +2,7 @@ {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveFoldable #-} {-# LANGUAGE DeriveTraversable #-}+{-# LANGUAGE CPP #-} {-# OPTIONS_GHC -Wall #-} @@ -194,12 +195,19 @@ class. -} singletons :: Eq k => Set k -> v -> DisjointMap k v-singletons s v = case S.lookupMin s of+singletons s v = case setLookupMin s of Nothing -> empty Just x -> let p = M.fromSet (\_ -> x) s r = M.singleton x (Ranked 1 s v) in DisjointMap p r++setLookupMin :: Set a -> Maybe a+#if MIN_VERSION_containers(0,5,9) +setLookupMin = S.lookupMin+#else+setLookupMin s = if S.size s > 0 then Just (S.findMin s) else Nothing+#endif {-| Find the set representative for this input. Returns a new disjoint
src/Data/DisjointSet.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE BangPatterns #-}+{-# LANGUAGE CPP #-} {-# OPTIONS_GHC -Wall #-} @@ -186,12 +187,19 @@ {-| Create a disjoint set where all members are equal. -} singletons :: Eq a => Set a -> DisjointSet a-singletons s = case S.lookupMin s of+singletons s = case setLookupMin s of Nothing -> empty Just x -> let p = M.fromSet (\_ -> x) s r = M.singleton x 1 in DisjointSet p r++setLookupMin :: Set a -> Maybe a+#if MIN_VERSION_containers(0,5,9) +setLookupMin = S.lookupMin+#else+setLookupMin s = if S.size s > 0 then Just (S.findMin s) else Nothing+#endif {-| Find the set representative for this input. Returns a new disjoint