- data UnionFindT p m a
- runUnionFind :: Monad m => UnionFindT p m a -> m a
- data Point a
- fresh :: Monad m => p -> UnionFindT p m (Point p)
- repr :: Monad m => Point p -> UnionFindT p m (Point p)
- descriptor :: Monad m => Point p -> UnionFindT p m p
- union :: Monad m => Point p -> Point p -> UnionFindT p m ()
- equivalent :: Monad m => Point p -> Point p -> UnionFindT p m Bool
A monad transformer that adds union find operations.
p parameter is the type of points. Uses the
Data.UnionFind.IntMap as the underlying union-find
Create a new point with the given descriptor. The returned is only equivalent to itself.
Note that a
Point has its own identity. That is, if two points
are equivalent then their descriptors are equal, but not vice
repr point returns the representative point of
point's equivalence class.
Join the equivalence classes of the points. The resulting equivalence class will get the descriptor of the second argument.