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

Safe HaskellSafe
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)

(>>>) :: Category k cat => cat a b -> cat b c -> cat a c infixr 1

Left-to-right composition

traverse_ :: (Foldable t, Applicative f) => (a -> f b) -> t a -> f ()

Map each element of a structure to an action, evaluate these actions from left to right, and ignore the results. For a version that doesn't ignore the results see traverse.