ref: 745d51dea272e0526bd4d2bf3240daa0b6f154c3
parent: c4bc15be02e492734c3acb0db1c00fbce841a13e
author: Lennart Augustsson <lennart.augustsson@epicgames.com>
date: Thu Feb 15 09:47:48 EST 2024
Change scc to use Ord
--- a/src/MicroHs/Desugar.hs
+++ b/src/MicroHs/Desugar.hs
@@ -131,7 +131,7 @@
ds = concat $ zipWith dsBind pvs ads
node ie@(i, e) = (ie, i, freeVars e)
gr = map node $ checkDup ds
- asccs = stronglyConnComp (<=) gr
+ asccs = stronglyConnComp gr
loop _ [] = ret
loop vs (AcyclicSCC (i, e) : sccs) =
letE i e $ loop vs sccs
--- a/src/MicroHs/Graph.hs
+++ b/src/MicroHs/Graph.hs
@@ -35,15 +35,15 @@
stronglyConnComp
:: forall key node .
- (key -> key -> Bool)
- -> [(node, key, [key])]
+ Ord key
+ => [(node, key, [key])]
-- ^ The graph: a list of nodes uniquely identified by keys,
-- with a list of keys of nodes this node has edges to.
-- The out-list may contain keys that don't correspond to
-- nodes of the graph; such edges are ignored.
-> [SCC node]
-stronglyConnComp le edges0
- = map get_node (stronglyConnCompR le edges0)
+stronglyConnComp edges0
+ = map get_node (stronglyConnCompR (<=) edges0)
where
get_node (AcyclicSCC (n, _, _)) = AcyclicSCC n
get_node (CyclicSCC triples) = CyclicSCC [n | (n,_,_) <- triples]
--
⑨