WeakSets 1.2.3.0 → 1.2.4.0
raw patch · 3 files changed
+13/−4 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Data.WeakSet: instance GHC.Base.Alternative Data.WeakSet.Set
Files
- CHANGELOG.md +5/−1
- WeakSets.cabal +1/−1
- src/Data/WeakSet.hs +7/−2
CHANGELOG.md view
@@ -42,4 +42,8 @@ # 1.2.3.0 -- 2022-07-25 -* Adding all functions from Foldable+* Adding all functions from Foldable + +# 1.2.4.0 -- 2022-07-26 + +* Adding Alternative instance
WeakSets.cabal view
@@ -14,7 +14,7 @@ -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change -version: 1.2.3.0 +version: 1.2.4.0 -- A short (one-line) description of the package. synopsis:
src/Data/WeakSet.hs view
@@ -167,10 +167,11 @@ , cartesianProductOfSet ) where -import Prelude hiding (filter, splitAt, drop, take, map, foldr, foldl, length, elem, maximum, minimum, sum, product, concat, concat2, concatMap, and, or, any, all, maximumBy, minimumBy, notElem, find, null) +import Prelude hiding (filter, splitAt, drop, take, map, foldr, foldl, length, elem, maximum, minimum, sum, product, concat, concatMap, and, or, any, all, maximumBy, minimumBy, notElem, find, null) import qualified Data.List as L import qualified Data.Maybe as M -import Control.Applicative (liftA2) +import Control.Applicative (liftA2, Alternative, (<|>)) +import qualified Control.Applicative as Applicative import qualified Data.Foldable as Foldable -- | A weak set is a list of values such that the duplicate elements and the order of the elements are disregarded. @@ -197,6 +198,10 @@ instance Monad Set where (>>=) (Set xs) f = Set $ xs >>= (unsafeSetToList.f) + +instance Alternative Set where + (<|>) = (|||) + empty = mempty instance (Show a) => Show (Set a) where show (Set xs) = "(set "++show xs++")"