-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Persistent equivalence relations (aka union-find) -- -- This is a semi-persistent data structure for equivalence relations -- (known in the imperative world as union-find or disjoint set union). -- It exhibits optimal performance when used in a linear pattern, but -- degrades when other access patterns are used. -- -- The basic idea is as given by Conchon and Filliatre in their 2007 -- paper, "A persistent union-find data structure." Unlike the -- implementation given in the paper, this version is safe with multiple -- threads, but does not optimize for backtracking. -- -- Version 0.2 removes unnecessary atomic operations when doing updates -- that are never semantically meaningful, hopefully leading to better -- scalability in a parallel setting. @package persistent-equivalence @version 0.2 -- | Code for manipulation of equivalence classes on index types. An -- Equivalence is an equivalence relation. The empty equivalence -- relation is constructed over a ranges of values using -- emptyEquivalence. Less discerning equivalence relations can be -- obtained with equate and equateAll. The relation can be -- tested with equiv and equivalent, and canonical -- representatives can be chosen with repr. -- -- An example follows: -- --
-- import Data.Equivalence.Persistent -- -- rel = equateAll [1,3,5,7,9] -- . equate 5 6 -- . equate 2 4 -- $ emptyEquivalence (1,10) -- -- test1 = equiv rel 3 5 -- This is True -- test2 = equiv rel 1 6 -- This is True -- test3 = equiv rel 4 6 -- This is False --module Data.Equivalence.Persistent -- | An Equivalence is an equivalence relation on a range of values -- of some index type. data Equivalence i -- | emptyEquivalence is an equivalence relation that equates two -- values only when they are equal to each other. It is the most -- discerning such relation possible. emptyEquivalence :: Ix i => (i, i) -> Equivalence i -- | Gets the domain of an equivalence relation, as the ordered pair of -- index bounds. domain :: Ix i => Equivalence i -> (i, i) -- | repr gives a canonical representative of the equivalence class -- containing x. It is chosen arbitrarily, but is always the -- same for a given class and Equivalence value. -- -- If you are using this function, you're probably doing something wrong. -- Please note that: -- --