Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data UnionST s l
- runUnionST :: (forall s. ST s (UnionST s l)) -> Union l
- new :: Int -> l -> ST s (UnionST s l)
- grow :: UnionST s l -> Int -> ST s (UnionST s l)
- copy :: UnionST s l -> ST s (UnionST s l)
- lookup :: UnionST s l -> Int -> ST s (Int, l)
- annotate :: UnionST s l -> Int -> l -> ST s ()
- merge :: UnionST s l -> (l -> l -> (l, a)) -> Int -> Int -> ST s (Maybe a)
- flatten :: UnionST s l -> ST s ()
- size :: UnionST s l -> Int
- unsafeFreeze :: UnionST s l -> ST s (Union l)
Documentation
runUnionST :: (forall s. ST s (UnionST s l)) -> Union l Source #
Analogous to runSTArray
.
grow :: UnionST s l -> Int -> ST s (UnionST s l) Source #
Grow the capacity of a disjoint set forest. Shrinking is not possible. Trying to shrink a disjoint set forest will return the same forest unmodified.
lookup :: UnionST s l -> Int -> ST s (Int, l) Source #
Look up the representative of a given node and its label.
merge :: UnionST s l -> (l -> l -> (l, a)) -> Int -> Int -> ST s (Maybe a) Source #
Merge two nodes if they are in distinct equivalence classes. The passed function is used to combine labels, if a merge happens.
unsafeFreeze :: UnionST s l -> ST s (Union l) Source #
Analogous to unsafeFreeze