moduleLanguage.Atom.Analysis(topo,ruleComplexity)whereimportLanguage.Atom.ElaborationimportLanguage.Atom.Expressions-- | Topologically sorts a list of expressions and subexpressions.topo::[UE]->[(UE,String)]topoues=reverseues'wherestart=0(_,ues')=foldlcollect(start,[])uescollect::(Int,[(UE,String)])->UE->(Int,[(UE,String)])collect(n,ues)ue|any((==ue).fst)ues=(n,ues)collect(n,ues)ue=(n'+1,(ue,en'):ues')where(n',ues')=foldlcollect(n,ues)$ueUpstreamuee::Int->Stringei="__"++showi-- | Number of UE's computed in rule.ruleComplexity::Rule->IntruleComplexity=length.topo.allUEs