packages feed

persistent-equivalence 0.1 → 0.1.1

raw patch · 2 files changed

+17/−10 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

Data/Equivalence/Persistent.hs view
@@ -68,15 +68,22 @@ {-|     'repr' gives a canonical representative of the equivalence class     containing @x@.  It is chosen arbitrarily, but is always the same for a-    given equivalence relation.+    given 'Equivalence' value. -    This function is slightly unsafe.  In particular, it's possible to build-    the same equivalence relation by equating values in two different orders,-    and the choice of canonical representatives will differ.  You can either-    think of a value of type 'Equivalence' as an equivalence relation together-    with a choice of canonical representatives, or you can consider this not a-    pure function.  Since 'Equivalence' is not an instance of @Eq@ and equality-    is not observable, both perspectives are valid.+    If you are using this function, you're probably doing something wrong.+    Please note that:++    * The representative chosen depends on the order in which the+      equivalence relation was built, and are not always the same for+      values that represent the same relation.+    * The representative is not particularly stable.  Uses of 'equate' are+      highly likely to change it.+    * If all you need is some representative of the equivalence class,+      you have to provide one as input to the function anyway, so you+      may as well use that.++    Because of this, the function may be removed in a future version.  Please+    contact me if you have a compelling use for it. -} repr :: Ix i => Equivalence i -> i -> i repr (Equivalence rs vps) i = unsafePerformIO $ atomicModifyIORef vps f@@ -117,7 +124,7 @@                       in Equivalence rs (unsafePerformIO (newIORef ps'))         | otherwise = let ps' = ps // [(py, px)]                           rs' = rs // [(px, (rx + 1))]-                      in Equivalence rs (unsafePerformIO (newIORef ps'))+                      in Equivalence rs' (unsafePerformIO (newIORef ps'))       where rx = rs ! px             ry = rs ! py 
persistent-equivalence.cabal view
@@ -1,5 +1,5 @@ Name:                persistent-equivalence-Version:             0.1+Version:             0.1.1 Synopsis:            Persistent equivalence relations (aka union-find) Description:         This is a semi-persistent data structure for equivalence                      relations (known in the imperative world as union-find