closure-0.1.0.0: Depth- and breadth-first set closures

Portabilitynon-portable
Stabilityexperimental
Maintainerme@jspha.com
Safe HaskellNone

Algebra.Closure.Set.DepthFirst

Contents

Description

Depth-first closed sets. For a particular endomorphism (p :: a -> a) a Closed set is a set where if some element x is in the set then so is p x.

Synopsis

Closed sets

data Closed a Source

A closed set Closed a, given an endomorphism (p :: a -> a), is a set where if some element x is in the set then so is p x.

seen :: Closed a -> HashSet aSource

Access the underlying set.

Operations

member :: (Hashable a, Eq a) => a -> Closed a -> BoolSource

Is a particular element in the closure of this set?

Creation

empty :: (a -> a) -> Closed aSource

An empty closed set under a fixed endomorphism.

insert :: (Hashable a, Eq a) => a -> Closed a -> Closed aSource

Inserts a new element into a Closed set, maintaining closure.

close :: (Hashable a, Eq a, Foldable t) => (a -> a) -> t a -> Closed aSource

Converts any Foldable container into the Closed set of its contents.