enumerate-0.2.2: enumerate all the values in a finite type (automatically)

Safe HaskellNone
LanguageHaskell2010

Enumerate.Extra

Description

 

Synopsis

Documentation

powerSet :: Ord a => Set a -> Set (Set a) Source #

the power set of a set of values.

>>> (powerset2matrix . powerSet . Set.fromList) [1..3]
[[],[1],[2],[3],[1,2],[1,3],[2,3],[1,2,3]]

dropEach :: Ord a => Set a -> Set (Set a) Source #

>>> (powerset2matrix . dropEach . Set.fromList) [1..3]
[[1,2],[1,3],[2,3]]

powerset2matrix :: Set (Set a) -> [[a]] Source #

convert a power set to an isomorphic matrix, sorting the entries.

(for doctest)

printMappings :: Show a => [[a]] -> IO () Source #

(for doctest)