set-extra 1.3.2 → 1.4
raw patch · 2 files changed
+9/−1 lines, 2 files
Files
- Data/Set/Extra.hs +8/−0
- set-extra.cabal +1/−1
Data/Set/Extra.hs view
@@ -19,6 +19,7 @@ , distrib , cartesianProduct , groupBy+ , powerset , partitionM , unzip , gFind@@ -103,6 +104,13 @@ groupBy :: (Ord a, Ord b) => (a -> b) -> Set a -> Map.Map b (Set a) groupBy f xs = fold (\ x m -> Map.insertWith union (f x) (singleton x) m) Map.empty xs++powerset :: Ord a => Set a -> Set (Set a)+powerset s+ | s == Set.empty = singleton Set.empty+ | otherwise = Set.map (insert x) pxs `union` pxs+ where (x, xs) = deleteFindMin s+ pxs = powerset xs partitionM :: (Monad m, Ord a) => (a -> m Bool) -> Set a -> m (Set a, Set a) partitionM p xs =
set-extra.cabal view
@@ -1,5 +1,5 @@ Name: set-extra-Version: 1.3.2+Version: 1.4 License: BSD3 License-File: COPYING Author: David Fox