- relevant_binds_and_sigs = [(binds,sigs) | (vertex, _, _, binds, sigs) <- mbi,
- vertex `is_elem` cycle]
- (binds, sig_lists) = unzip relevant_binds_and_sigs
- this_gp_binds = foldr1 AndMonoBinds binds
- this_gp_sigs = foldr1 (++) sig_lists
-
- is_elem = isIn "reconstructRec"
-
- mk_binds :: RenamedMonoBinds -> [RenamedSig] -> Bool -> RenamedHsBinds
- mk_binds bs [] True = SingleBind (RecBind bs)
- mk_binds bs ss True = BindWith (RecBind bs) ss
- mk_binds bs [] False = SingleBind (NonRecBind bs)
- mk_binds bs ss False = BindWith (NonRecBind bs) ss
-
- -- moved from Digraph, as this is the only use here
- -- (avoid overloading cost). We have to use elem
- -- (not FiniteMaps or whatever), because there may be
- -- many edges out of one vertex. We give it its own
- -- "elem" just for speed.
-
- isCyclic es [] = panic "isCyclic: empty component"
- isCyclic es [v] = (v,v) `elem` es
- isCyclic es vs = True
-
- elem _ [] = False
- elem x (y:ys) = x==y || elem x ys
+ this_gp_binds = foldr1 AndMonoBinds [binds | (_, _, binds, _) <- cycle]
+ this_gp_sigs = foldr1 (++) [sigs | (_, _, _, sigs) <- cycle]