packages feed

WeakSets 1.3.3.0 → 1.4.0.0

raw patch · 3 files changed

+8/−4 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -62,4 +62,8 @@ 
 # 1.3.3.0 -- 2022-08-30
 
-* Bug correction in pairs.+* Bug correction in pairs.
+
+# 1.3.4.0 -- 2022-08-30
+
+* Bug correction in maybeSecond.
WeakSets.cabal view
@@ -14,7 +14,7 @@ -- PVP summary:      +-+------- breaking API changes
 --                   | | +----- non-breaking API additions
 --                   | | | +--- code changes with no API change
-version:            1.3.3.0
+version:             1.4.0.0
 
 -- A short (one-line) description of the package.
 synopsis:
src/Math/PureSet.hs view
@@ -111,7 +111,7 @@     maybeSecond :: PureSet -> Maybe PureSet
     maybeSecond i@(PureSet s)
         | length l == 1 = if card (anElement s) == 1 then Just (anElement.pureSetToSet.anElement $ s) else Nothing
-        | length l == 2 = if r2 !! 0 == first i then Just (r2 !! 1) else (if r2 !! 1 == first i then Just (r2 !! 0) else Nothing)
+        | length l == 2 = if length r2 /= 2 then Nothing else (if r2 !! 0 == first i then Just (r2 !! 1) else (if r2 !! 1 == first i then Just (r2 !! 0) else Nothing))
         | otherwise = Nothing
         where
             l = setToList s
@@ -179,6 +179,6 @@                                     in 
                                         if (not anyMissing) && (set (Just <$> [0..maxNb])) == (set numbers) then Just (maxNb + 1) else Nothing
                 toPair x
-                    | null (maybeSecond x) = Nothing
+                    | null (maybeSecond x) || null (maybeFirst x) = Nothing
                     | otherwise = Just $ "(" ++ (formatPureSet.first $ x) ++ "," ++ (formatPureSet.second $ x) ++ ")"