packages feed

WeakSets 1.3.1.0 → 1.3.2.0

raw patch · 3 files changed

+10/−9 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -54,4 +54,8 @@ 
 # 1.3.1.0 -- 2022-08-29
 
-* Addition of first and second functions for PureSet.+* Addition of first and second functions for PureSet.
+
+# 1.3.2.0 -- 2022-08-30
+
+* Bug correction in formatPureSet.
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.1.0
+version:            1.3.2.0
 
 -- A short (one-line) description of the package.
 synopsis:
src/Math/PureSet.hs view
@@ -46,10 +46,7 @@     import Data.Maybe   (fromJust, catMaybes)
     
     -- | A `PureSet` is a `Set` of other pure sets.
-    data PureSet = PureSet (Set PureSet) deriving (Eq)
-    
-    instance Show PureSet where
-        show (PureSet xs) = "(pureSet "++ show (setToList xs) ++")"
+    data PureSet = PureSet (Set PureSet) deriving (Eq, Show)
     
     -- | Construct a `PureSet` from a list of pure sets.
     pureSet :: [PureSet] -> PureSet
@@ -152,11 +149,11 @@                                         maxNb = maximum $ catMaybes numbers
                                     in 
                                         if (not anyMissing) && (set (Just <$> [0..maxNb])) == (set numbers) then Just (maxNb + 1) else Nothing
-                toPair (PureSet xs)
+                toPair x@(PureSet xs)
                     | cardinal xs == 2 = 
                         case () of
-                         () | ((card $ (setToList xs) !! 0) == 1 && (card $ (setToList xs) !! 1) == 2) && ((setToList xs) !! 0) `isInP` ((setToList xs) !! 1) -> Just $ "(" ++ (formatPureSet.head.setToList.pureSetToSet $ ((setToList xs) !! 0)) ++ "," ++ (formatPureSet.head.setToList.pureSetToSet $ (((setToList xs) !! 1) \\\\ ((setToList xs) !! 0))) ++ ")"
-                            | ((card $ (setToList xs) !! 1) == 1 && (card $ (setToList xs) !! 0) == 2) && ((setToList xs) !! 1) `isInP` ((setToList xs) !! 0) -> Just $ "(" ++ (formatPureSet.head.setToList.pureSetToSet $ ((setToList xs) !! 1)) ++ "," ++ (formatPureSet.head.setToList.pureSetToSet $ (((setToList xs) !! 0) \\\\ ((setToList xs) !! 1))) ++ ")"
+                         () | ((card $ (setToList xs) !! 0) == 1 && (card $ (setToList xs) !! 1) == 2) && (first x) `isInP` ((setToList xs) !! 1) -> Just $ "(" ++ (formatPureSet.first $ x) ++ "," ++ (formatPureSet.second $ x) ++ ")"
+                            | ((card $ (setToList xs) !! 1) == 1 && (card $ (setToList xs) !! 0) == 2) && (first x) `isInP` ((setToList xs) !! 0) -> Just $ "(" ++ (formatPureSet.first $ x) ++ "," ++ (formatPureSet.second $ x) ++ ")"
                             | otherwise -> Nothing
                     | otherwise = Nothing