summaryrefslogtreecommitdiff
path: root/src/Data/Graph/Dynamic
diff options
context:
space:
mode:
authorJasperVanDerJeugt <>2019-01-11 23:50:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2019-01-11 23:50:00 (GMT)
commit953ba3f0255739342f634172784e830ea87d8e5a (patch)
treef2a374d89b92ee3732933ec7aefaea15e6aae3a2 /src/Data/Graph/Dynamic
parent6a7ef9d8008cb5469c3d720cf066cc2745780616 (diff)
version 0.1.0.20.1.0.2
Diffstat (limited to 'src/Data/Graph/Dynamic')
-rw-r--r--src/Data/Graph/Dynamic/Internal/Random.hs2
-rw-r--r--src/Data/Graph/Dynamic/Levels.hs4
2 files changed, 4 insertions, 2 deletions
diff --git a/src/Data/Graph/Dynamic/Internal/Random.hs b/src/Data/Graph/Dynamic/Internal/Random.hs
index 5b83db8..96ebbdf 100644
--- a/src/Data/Graph/Dynamic/Internal/Random.hs
+++ b/src/Data/Graph/Dynamic/Internal/Random.hs
@@ -58,7 +58,7 @@ data T s a v = T
--
-- They seem to offer similar performance. We choose to use the latter since it
-- is less likely to end up in infinite loops that way, and additionally, we can
--- move easily move e.g. x's left child to y's right child, even it is an empty
+-- more easily move e.g. x's left child to y's right child, even it is an empty
-- child.
nil :: Tree s a v
nil = unsafeCoerce $ unsafePerformIO $ Tree <$> MutVar.newMutVar undefined
diff --git a/src/Data/Graph/Dynamic/Levels.hs b/src/Data/Graph/Dynamic/Levels.hs
index cce4366..70b9ee9 100644
--- a/src/Data/Graph/Dynamic/Levels.hs
+++ b/src/Data/Graph/Dynamic/Levels.hs
@@ -235,7 +235,9 @@ cut (Graph levels) a b = do
aSize <- ET.componentSize etf a
bSize <- ET.componentSize etf b
let (smaller, _bigger) = if aSize <= bSize then (a, b) else (b, a)
- Just sRoot <- ET.findRoot etf smaller
+ sRoot <- fromMaybe
+ (error "root must exist because cut returned True") <$>
+ (ET.findRoot etf smaller)
-- These are all edges, and vertices within the smaller tree.
sTreeEdges <- Tree.toList sRoot