diff --git a/src-ag/ExecutionPlanCommon.ag b/src-ag/ExecutionPlanCommon.ag
new file mode 100644
--- /dev/null
+++ b/src-ag/ExecutionPlanCommon.ag
@@ -0,0 +1,161 @@
+-------------------------------------------------------------------------------
+--         Distributing options
+-------------------------------------------------------------------------------
+ATTR Grammar Nonterminals Nonterminal Productions Production Children Child
+  [ options : {Options} | | ]
+
+-------------------------------------------------------------------------------
+--         Find out which nonterminals are recursive
+-------------------------------------------------------------------------------
+
+ATTR Nonterminals Nonterminal [ | | ntDeps, ntHoDeps USE {`mappend`} {mempty} : {Map NontermIdent (Set NontermIdent)} ]
+ATTR Nonterminals Nonterminal [ closedNtDeps, closedHoNtDeps, closedHoNtRevDeps : {Map NontermIdent (Set NontermIdent)} | | ]
+ATTR Productions Production Children Child [ | | refNts, refHoNts USE {`mappend`} {mempty} : {Set NontermIdent} ]
+
+SEM Nonterminal | Nonterminal
+  lhs.ntDeps            = Map.singleton @nt @prods.refNts
+  lhs.ntHoDeps          = Map.singleton @nt @prods.refHoNts
+
+  loc.closedNtDeps      = Map.findWithDefault Set.empty @nt @lhs.closedNtDeps
+  loc.closedHoNtDeps    = Map.findWithDefault Set.empty @nt @lhs.closedHoNtDeps
+  loc.closedHoNtRevDeps = Map.findWithDefault Set.empty @nt @lhs.closedHoNtRevDeps
+
+  loc.recursive         = @nt `Set.member` @loc.closedNtDeps
+  loc.nontrivAcyc       = @nt `Set.member` @loc.closedHoNtDeps
+  loc.hoInfo            = HigherOrderInfo { hoNtDeps            = @loc.closedHoNtDeps
+                                          , hoNtRevDeps         = @loc.closedHoNtRevDeps
+                                          , hoAcyclic           = @loc.nontrivAcyc
+                                          }
+
+SEM Child | Child
+  loc.refNts = case @tp of
+                 NT nt _ _ -> Set.singleton nt
+                 _         -> mempty
+  loc.refHoNts = if @loc.isHigherOrder then @loc.refNts else mempty
+  loc.isHigherOrder = case @kind of
+                        ChildSyntax -> False
+                        _           -> True
+
+SEM Grammar | Grammar
+  loc.closedNtDeps      = closeMap @nonts.ntDeps
+  loc.closedHoNtDeps    = closeMap @nonts.ntHoDeps
+  loc.closedHoNtRevDeps = revDeps @loc.closedHoNtDeps
+
+-------------------------------------------------------------------------------
+--         Distribute the ContextMap to nonterminals
+-------------------------------------------------------------------------------
+
+ATTR Nonterminals Nonterminal [ classContexts : ContextMap | | ]
+
+SEM Grammar | Grammar
+  nonts.classContexts = @contextMap
+
+SEM Nonterminal | Nonterminal
+  loc.classContexts = Map.findWithDefault [] @nt @lhs.classContexts
+
+-------------------------------------------------------------------------------
+--         Gather all rules per production for the execution plan
+-------------------------------------------------------------------------------
+ATTR Expression [ | | copy : SELF ]
+
+ATTR Rule  [ | | erules : ERule ]
+ATTR Rules [ | | erules USE {:} {[]} : ERules  ]
+
+SEM Rule
+  | Rule lhs.erules = ERule @loc.rulename
+                            @pattern.copy
+                            @rhs.copy
+                            @owrt
+                            @origin
+                            @explicit
+                            @pure
+                            @mbError
+
+-------------------------------------------------------------------------------
+--         Determine which children have an around-rule
+-------------------------------------------------------------------------------
+
+-- Propagate the around-map downward
+ATTR Nonterminals Nonterminal
+  [ aroundMap : {Map NontermIdent (Map ConstructorIdent (Map Identifier [Expression]))} || ]
+
+ATTR Productions Production
+  [ aroundMap : {Map ConstructorIdent (Map Identifier [Expression])} || ]
+
+ATTR Children Child
+  [ aroundMap : {Map Identifier [Expression]} | | ]
+
+SEM Nonterminal | Nonterminal  loc.aroundMap = Map.findWithDefault Map.empty @nt @lhs.aroundMap
+SEM Production | Production    loc.aroundMap = Map.findWithDefault Map.empty @con @lhs.aroundMap
+
+SEM Grammar | Grammar
+  nonts.aroundMap = @aroundsMap
+
+SEM Child | Child
+  loc.hasArounds = case Map.lookup @name @lhs.aroundMap of
+                     Nothing -> False
+                     Just as -> not (null as)
+
+-------------------------------------------------------------------------------
+--         Determine which children are used by merges
+-------------------------------------------------------------------------------
+
+-- Propagate the around-map downward
+ATTR Nonterminals Nonterminal
+  [ mergeMap : {Map NontermIdent (Map ConstructorIdent (Map Identifier (Identifier, [Identifier], Expression)))} || ]
+
+ATTR Productions Production
+  [ mergeMap : {Map ConstructorIdent (Map Identifier (Identifier, [Identifier], Expression))} || ]
+
+ATTR Children Child
+  [ mergeMap : {Map Identifier (Identifier, [Identifier], Expression)} mergedChildren : {Set Identifier} | | ]
+
+SEM Nonterminal | Nonterminal  loc.mergeMap = Map.findWithDefault Map.empty @nt @lhs.mergeMap
+SEM Production | Production    loc.mergeMap = Map.findWithDefault Map.empty @con @lhs.mergeMap
+
+SEM Grammar | Grammar
+  nonts.mergeMap = @mergeMap
+
+SEM Production | Production
+  loc.mergedChildren = Set.unions [ Set.fromList ms | (_,ms,_) <- Map.elems @loc.mergeMap ]
+
+SEM Child | Child
+  loc.merges   = maybe Nothing (\(_,ms,_) -> Just ms) $ Map.lookup @name @lhs.mergeMap
+  loc.isMerged = @name `Set.member` @lhs.mergedChildren
+
+
+-------------------------------------------------------------------------------
+--         Gather all childs per production for the execution plan
+-------------------------------------------------------------------------------
+
+ATTR Child    [ | | echilds : EChild ]
+ATTR Children [ | | echilds USE {:} {[]} : EChildren ]
+
+SEM Child
+  | Child lhs.echilds = case @tp of
+                          NT _ _ _ -> EChild @name @tp @kind @loc.hasArounds @loc.merges @loc.isMerged
+                          _        -> ETerm @name @tp
+
+-------------------------------------------------------------------------------
+--         Output nonterminal type mappings
+-------------------------------------------------------------------------------
+ATTR Grammar
+     Nonterminals  [ | | inhmap USE {`Map.union`} {Map.empty} : {Map.Map NontermIdent Attributes}
+     	                 synmap USE {`Map.union`} {Map.empty} : {Map.Map NontermIdent Attributes} ]
+
+ATTR Nonterminal [ | | inhmap : {Map.Map NontermIdent Attributes}
+     		       synmap : {Map.Map NontermIdent Attributes} ]
+SEM Nonterminal
+  | Nonterminal lhs.inhmap = Map.singleton @nt @inh
+    		lhs.synmap = Map.singleton @nt @syn
+
+-------------------------------------------------------------------------------
+--         Output nonterminal type mappings
+-------------------------------------------------------------------------------
+ATTR Grammar Nonterminals Nonterminal [ | | localSigMap USE {`Map.union`} {Map.empty} : {Map.Map NontermIdent (Map.Map ConstructorIdent (Map.Map Identifier Type))} ]
+ATTR Productions Production           [ | | localSigMap USE {`Map.union`} {Map.empty} : {Map.Map ConstructorIdent (Map.Map Identifier Type)} ]
+ATTR TypeSigs TypeSig                 [ | | localSigMap USE {`Map.union`} {Map.empty} : {Map Identifier Type} ]
+
+SEM Nonterminal | Nonterminal  lhs.localSigMap = Map.singleton @nt @prods.localSigMap
+SEM Production | Production    lhs.localSigMap = Map.singleton @con @typeSigs.localSigMap
+SEM TypeSig | TypeSig          lhs.localSigMap = Map.singleton @name @tp
diff --git a/src-ag/ExecutionPlanPre.ag b/src-ag/ExecutionPlanPre.ag
new file mode 100644
--- /dev/null
+++ b/src-ag/ExecutionPlanPre.ag
@@ -0,0 +1,15 @@
+-------------------------------------------------------------------------------
+--         Give unique names to rules
+-------------------------------------------------------------------------------
+ATTR Nonterminal Nonterminals
+     Production Productions
+     Rule Rules  [ | rulenumber : Int | ]
+
+SEM  Grammar
+  |  Grammar nonts.rulenumber = 0
+
+SEM  Rule
+  |  Rule lhs.rulenumber = @lhs.rulenumber + 1
+     	  loc.rulename   = maybe (identifier $ "rule" ++ show @lhs.rulenumber) id @mbName
+
+
diff --git a/src-ag/LOAG/Prepare.ag b/src-ag/LOAG/Prepare.ag
new file mode 100644
--- /dev/null
+++ b/src-ag/LOAG/Prepare.ag
@@ -0,0 +1,316 @@
+INCLUDE "AbstractSyntax.ag"
+INCLUDE "Patterns.ag"
+INCLUDE "CodeSyntax.ag"
+INCLUDE "Expression.ag"
+INCLUDE "HsToken.ag"
+INCLUDE "LOAG/Rep"
+INCLUDE "ExecutionPlanPre"
+
+MODULE {LOAG.Prepare}
+{}
+{}
+
+{
+-- | Translating UUAGC types to MyTypes
+drhs f | f == _LHS               = Inh
+       | f == _LOC               = AnyDir
+       | f == _INST              = AnyDir
+       | otherwise               = Syn
+dlhs f | f == _LHS               = Syn
+       | f == _LOC               = AnyDir
+       | f == _INST              = AnyDir
+       | otherwise               = Inh 
+
+depToEdge :: PMP_R -> PLabel -> Dependency -> Edge
+depToEdge pmpr p e = 
+    (findWithErr pmpr "depToEdge" $ MyOccurrence (p,getName f1) (getName i1, drhs f1),
+     findWithErr pmpr "depToEdge" $ MyOccurrence (p,getName f2) (getName i2, dlhs f2))
+    where Dependency (OccAttr f1 i1) (OccAttr f2 i2) = e
+
+vertexToAttr :: NMP -> Vertex -> Attributes
+vertexToAttr nmp v = Map.singleton (identifier a) (fromMyTy ty)
+    where (MyAttribute ty (a,_)) = findWithErr nmp "vertexToAttr" v
+
+}
+
+SEM Grammar | Grammar
+    inst.smf : LOAGRep 
+    loc.initO= if Map.null @nonts.pmp then 1 else fst $ Map.findMin @nonts.pmp
+    inst.smf = 
+        LOAGRep @nonts.ps @nonts.ap @loc.an 
+           @loc.ain @loc.asn @loc.sfp
+           @nonts.pmp @nonts.pmpr @loc.nmp @loc.nmpr
+           (A.array (@loc.initO, @loc.initO + Map.size @nonts.gen)  $ 
+                Map.toList $ @nonts.gen)
+           (A.array (1,Map.size @nonts.inss) $ 
+                Map.toList $ @nonts.inss)
+           (A.array (@loc.initO, @loc.initO + length @nonts.ofld) $ 
+                @nonts.ofld) @nonts.fty @nonts.fieldMap @nonts.fsInP
+    loc.nmp  = Map.fromList $ zip [1..] @loc.atts
+    loc.nmpr = Map.fromList $ zip @loc.atts [1..]
+    loc.an   = Map.unionWith (++) @loc.ain @loc.asn
+    loc.ain  = @nonts.inhs
+    loc.asn  = @nonts.syns
+    loc.atts = concat $ Map.elems @loc.an
+    loc.occs = concat $ Map.elems @nonts.ap
+    nonts.augM = @manualAttrOrderMap
+
+-- Collecting the attributes 
+ATTR Nonterminals Nonterminal [
+    augM   : {Map.Map Identifier (Map.Map Identifier (Set.Set Dependency))} ||  
+    inhs USE {Map.union} {Map.empty} : AI_N 
+    syns USE {Map.union} {Map.empty} : AS_N ]
+    
+SEM Nonterminal | Nonterminal 
+    lhs.inhs = let dty = TyData (getName @nt) 
+                in Map.singleton dty (toMyAttr Inh dty @inh)
+    lhs.syns = let dty = TyData (getName @nt) 
+                in Map.singleton dty (toMyAttr Syn dty @syn)
+    prods.augM = case Map.lookup @nt @lhs.augM of
+                    Nothing -> Map.empty 
+                    Just a  -> a
+
+-- Adding all attribute sets to the AG type 
+--   and sending it all down the abstract tree
+ATTR Nonterminals Nonterminal Productions Production Children Child 
+    MySegments MySegment [
+    ain   : {MyType -> MyAttributes} 
+    asn   : {MyType -> MyAttributes}
+    pmpf  : PMP
+    pmprf : PMP_R
+    lfpf  : SF_P
+    hoMapf: HOMap
+    fty   : FTY
+    nmp   : NMP || ]
+
+SEM Grammar | Grammar
+    nonts.ain  = map2F @loc.ain
+    nonts.asn  = map2F @loc.asn
+    nonts.pmpf  = @nonts.pmp
+    nonts.pmprf = @nonts.pmpr
+    nonts.lfpf  = @nonts.lfp
+    nonts.hoMapf= @nonts.hoMap
+    nonts.ftyf  = @nonts.fty
+    nonts.fty   = @nonts.fty
+
+-- Make sure TDP AND LFPRF are passed around correctly to code-generation
+ATTR Nonterminals Nonterminal Productions Production [
+    ftyf: FTY ||]
+
+
+-- Calculate the set of production labels
+SEM Grammar | Grammar 
+     loc.ps = @nonts.ps
+ATTR Nonterminals Nonterminal Productions Production [ || 
+    ads USE {(++)} {[]}   : {[Edge]}
+    fieldMap USE {(Map.union)} {Map.empty} : FMap
+    hoMap    USE {(Map.union)} {Map.empty} : HOMap
+    fsInP USE {(Map.union)} {Map.empty} : FsInP]
+
+SEM Nonterminals Nonterminal [ ||
+    ps  USE {(++)} {([])} : {[PLabel]} ]
+SEM Productions [ ||
+    ps  USE {:} {([])} : {[PLabel]}  ]
+SEM Production [ || ps : PLabel ] | Production 
+    loc.ps = (@lhs.dty,getName @con)
+    lhs.ads   = 
+        case Map.lookup @con @lhs.augM of
+         Nothing -> []
+         Just a  -> Set.toList $ Set.map (depToEdge @children.pmpr @loc.pll) a
+    children.dty = @lhs.dty
+
+ATTR Productions Production [
+   augM : {Map.Map Identifier (Set.Set Dependency)} || ]
+-- We didnt calculate A_P yet, inheriting A_N we can
+ATTR Productions Production Rules Rule [ 
+    -- result type of this constructor 
+    dty : {MyType} || ]
+ATTR Rules Rule Children Child Expression HsTokensRoot HsTokens HsToken [
+    pll : {PLabel} || ]
+SEM Nonterminal | Nonterminal    
+    loc.dty  = TyData (getName @nt)
+
+ATTR Nonterminals Nonterminal Productions Production Children Child 
+     FieldAtts FieldAtt [
+    an      : {MyType -> MyAttributes} 
+    nmprf   : NMP_R|
+    olab    : Int --  chained attribute for handing out labels to occurrences
+    flab    : Int  |--chained attribute for handing out labels to fields
+    ap   USE {Map.unionWith (++)} {Map.empty}   : A_P
+    gen  USE {Map.union}          {Map.empty}   : {Map Int Int}
+    inss USE {Map.unionWith (++)} {Map.empty}   : {Map Int [Int]}
+    pmp  USE {Map.union}          {Map.empty}   : PMP
+    pmpr USE {Map.union}          {Map.empty}   : PMP_R
+    -- maps for each occurrence to which field it belongs
+    ofld USE {(++)}             {[]}        : {[(Int, Int)]}
+    fty  USE {Map.union}          {Map.empty}   : FTY
+    ]
+
+SEM Grammar | Grammar 
+    nonts.an = map2F @loc.an
+    nonts.nmprf= @loc.nmpr
+    nonts.olab = if Map.null @loc.nmp then 0 else (fst $ Map.findMax @loc.nmp)
+    nonts.flab = 0
+
+ATTR Children Child [||
+    fieldMap USE {Map.union} {Map.empty} : FMap
+    hoMap    USE {Map.unionWith (Set.union)} {Map.empty} : HOMap
+    ]
+SEM Children [ dty : {MyType} || ]
+    | Nil 
+    loc.flab    = @lhs.flab + 1
+    loc.atp     = fst @lhs.pll
+    inst.fatts  : FieldAtts
+    inst.fatts  = map ((FieldAtt @loc.atp @lhs.pll "lhs") . alab) $ 
+                        @lhs.an @loc.atp
+    fatts.flab  = @loc.flab
+    loc.label   = (@lhs.pll, "lhs")
+    loc.foccsI  = Set.fromList $ handAllOut @loc.label $ @lhs.ain @loc.atp
+    loc.foccsS  = Set.fromList $ handAllOut @loc.label $ @lhs.asn @loc.atp
+    loc.fieldMap= Map.singleton @loc.label (@loc.foccsI, @loc.foccsS)
+    lhs.fty     = Map.singleton @loc.label @lhs.dty
+
+SEM Child | Child
+    loc.flab    = @lhs.flab + 1
+    loc.atp     = toMyTy @tp
+    inst.fatts  : FieldAtts
+    inst.fatts  = map ((FieldAtt @loc.atp @lhs.pll (getName @name)) . alab)
+                        $ @lhs.an @loc.atp
+    fatts.flab  = @loc.flab
+    loc.ident   = getName @name
+    loc.label   = (@lhs.pll, @loc.ident)
+    loc.foccsI  = Set.fromList $ handAllOut @loc.label $ @lhs.ain @loc.atp
+    loc.foccsS  = Set.fromList $ handAllOut @loc.label $ @lhs.asn @loc.atp
+    loc.fieldMap= if Set.null @loc.foccsI && Set.null @loc.foccsS
+                        then Map.empty 
+                        else Map.singleton @loc.label (@loc.foccsS,@loc.foccsI)
+    loc.hoMap   = case @kind of
+                    ChildAttr -> Map.singleton @lhs.pll (Set.singleton @loc.ident)
+                    _         -> Map.empty
+    lhs.fty     = Map.singleton (@lhs.pll, getName @name) @loc.atp
+
+SEM FieldAtt | FieldAtt
+    loc.olab    = @lhs.olab + 1
+    loc.alab    = findWithErr @lhs.nmprf "getting attr label" @loc.att
+    loc.att     = @t <.> @a
+    loc.occ     = (@p, @f) >.< @a
+    loc.pmp     = Map.singleton @loc.olab @loc.occ
+    loc.pmpr    = Map.singleton @loc.occ  @loc.olab
+    loc.inss    = Map.singleton @loc.alab [@loc.olab]
+    loc.gen     = Map.singleton @loc.olab @loc.alab
+    lhs.ap      = Map.singleton @p [@loc.occ]
+    lhs.ofld    = [(@loc.olab, @lhs.flab)]
+
+-- calculate representation of semantic function 
+-- definitions per non-terminal and from it, calculate E_P
+SEM Grammar | Grammar
+     loc.sfp = repLocRefs @nonts.lfp $ addHigherOrders @nonts.lfp @nonts.sfp
+ATTR Nonterminals Nonterminal Productions Production Rules Rule [ || 
+    sfp  USE {Map.unionWith (Set.union)} {Map.empty} : SF_P  -- deps of non-locals
+    ruleMap USE {Map.union} {Map.empty} : {Map.Map MyOccurrence Identifier} 
+    lfp  USE {Map.unionWith (Set.union)} {Map.empty} : SF_P  -- deps of local attrs
+    lfpr USE {Map.unionWith (Set.union)} {Map.empty} : SF_P ]-- reverse 
+SEM Production | Production
+    loc.pll   = (@lhs.dty,getName @con)
+    rules.pll = @pll 
+    rules.pts = @children.pts
+    lhs.fsInP = Map.singleton @pll $ Map.keys @children.fieldMap
+
+ATTR Children Child [ ||
+    pts USE {Set.union} {Set.empty} : {Set.Set FLabel} ]
+
+SEM Child | Child
+    lhs.pts = Set.singleton $ getName @name
+
+ATTR Rules Rule [
+    lfpf : SF_P ||
+    usedLocals USE {(Set.union)} {Set.empty} : {Set.Set MyOccurrence}]
+
+SEM Rule | Rule
+    loc.usedLocals = Set.filter (\(MyOccurrence (_,f) _) -> f == "loc") @rhs.used
+    loc.usesLocals = not $ Set.null @loc.usedLocals
+    (lhs.sfp,lhs.ruleMap,lhs.lfp,lhs.lfpr) = 
+        foldr (\(f, a, b) (m',rm', l', lr') -> 
+          let att = (@lhs.pll, f) >.< a
+              rm  = Map.insert att @rulename rm' 
+              l   = if @loc.usesLocals && not b
+                      then Map.insert att @loc.usedLocals l'
+                      else l'
+              lr  = if @loc.usesLocals && not b
+                     then Set.fold (\k m -> Map.insertWith (Set.union) k 
+                                 (Set.singleton att) m) lr' @loc.usedLocals
+                     else lr'
+              sfpins = Map.insert att (@rhs.used `Set.union` fromHO) m'
+              fromHO = maybe Set.empty id (Map.lookup hOcc @lhs.lfpf)
+                where hOcc = (@lhs.pll, "inst") >.< (f, AnyDir)
+              
+            in if b
+                then (m',rm, Map.insert att @rhs.used l, 
+                        Set.fold (\k m -> Map.insertWith (Set.union) k 
+                                (Set.singleton att) m) lr @rhs.used)
+                else (sfpins,rm,l,lr))
+                        (Map.empty,Map.empty,Map.empty,Map.empty) @pattern.afs
+
+ATTR Patterns Pattern [ ||
+    -- the boolean represents whether this occurrence is 
+    --   an transparent occurrence (only there to pass on dependencies)
+    afs USE {++} {[]} : {[(FLabel, ALabel, Bool)]} ]
+
+SEM Pattern | Alias
+    lhs.afs = let isLocal = (@field == _LOC || @field == _INST)
+               in [(getName @field, (getName @attr, dlhs @field), 
+                    isLocal)] ++ @pat.afs
+
+ATTR Rules Rule Expression HsTokensRoot HsTokens HsToken [
+    -- the terminals of current production
+    pts                : {Set.Set (FLabel)} || ]
+
+ATTR Rule Expression HsTokensRoot HsTokens HsToken [ ||
+    used USE {Set.union} {Set.empty} : {Set.Set MyOccurrence} ]
+
+SEM Expression | Expression
+    inst.tokens : HsTokensRoot
+    inst.tokens = HsTokensRoot @tks
+    tokens.pll  = @lhs.pll
+    tokens.pts  = @lhs.pts
+    lhs.used    = @tokens.used
+
+-- reference to terminals of which some are local attributes 
+SEM HsToken | AGLocal 
+    lhs.used = 
+        case getName @var `Set.member` @lhs.pts of
+          True  -> Set.empty 
+          -- local found without flabel
+          False -> Set.singleton $ (@lhs.pll, getName _LOC) >.< 
+                        (getName @var, drhs _LOC)
+-- includes both locals and attributes
+-- locals will be replaced later by repLocRefs
+SEM HsToken | AGField
+    lhs.used = Set.singleton $ (@lhs.pll, getName @field) >.< 
+                                (getName @attr, drhs @field)
+    
+{
+-- | Replace the references to local attributes, by his attrs dependencies,
+-- |    rendering the local attributes 'transparent'.
+repLocRefs :: SF_P -> SF_P -> SF_P
+repLocRefs lfp sfp =
+    Map.map (setConcatMap $ rep Set.empty) sfp
+    where rep :: Set.Set MyOccurrence -> MyOccurrence -> Set.Set MyOccurrence 
+          rep done occ | occ `Set.member` done = Set.empty
+                       | isLoc occ   = setConcatMap (rep $ Set.insert occ done) $ 
+                                       findWithErr lfp "repping locals" occ
+                       | otherwise   = Set.singleton occ
+
+-- | Add dependencies from a higher order child to all its attributes
+addHigherOrders :: SF_P -> SF_P -> SF_P
+addHigherOrders lfp sfp = 
+   Map.mapWithKey f $ Map.map (setConcatMap (\mo -> f mo (Set.singleton mo))) sfp
+   where f :: MyOccurrence -> Set.Set MyOccurrence -> Set.Set MyOccurrence
+         f mo@(MyOccurrence (p,f) _) deps =
+           let ho = ((p,"inst") >.< (f,AnyDir))
+           in  if ho `Map.member` lfp
+               then ho `Set.insert` deps
+               else deps
+}
+
+
diff --git a/src-generated/LOAG/Order.hs b/src-generated/LOAG/Order.hs
--- a/src-generated/LOAG/Order.hs
+++ b/src-generated/LOAG/Order.hs
@@ -110,11 +110,12 @@
 -- |    rendering the local attributes 'transparent'.
 repLocRefs :: SF_P -> SF_P -> SF_P
 repLocRefs lfp sfp =
-    Map.map (setConcatMap rep) sfp
-    where rep :: MyOccurrence -> Set.Set MyOccurrence 
-          rep occ | isLoc occ   = setConcatMap rep $ 
-                                    findWithErr lfp "repping locals" occ
-                  | otherwise   = Set.singleton occ
+    Map.map (setConcatMap $ rep Set.empty) sfp
+    where rep :: Set.Set MyOccurrence -> MyOccurrence -> Set.Set MyOccurrence 
+          rep done occ | occ `Set.member` done = Set.empty
+                       | isLoc occ   = setConcatMap (rep $ Set.insert occ done) $ 
+                                       findWithErr lfp "repping locals" occ
+                       | otherwise   = Set.singleton occ
 
 -- | Add dependencies from a higher order child to all its attributes
 addHigherOrders :: SF_P -> SF_P -> SF_P
@@ -126,14 +127,14 @@
            in  if ho `Map.member` lfp
                then ho `Set.insert` deps
                else deps
-{-# LINE 130 "dist/build/LOAG/Order.hs" #-}
+{-# LINE 131 "dist/build/LOAG/Order.hs" #-}
 
 {-# LINE 42 "src-ag/LOAG/Order.ag" #-}
 
 fst' (a,_,_) = a
 snd' (_,b,_) = b
 trd' (_,_,c) = c
-{-# LINE 137 "dist/build/LOAG/Order.hs" #-}
+{-# LINE 138 "dist/build/LOAG/Order.hs" #-}
 
 {-# LINE 95 "src-ag/LOAG/Order.ag" #-}
 
@@ -163,7 +164,7 @@
 ppOcc pmp v = text f >|< text "." >|< fst a
  where (MyOccurrence ((t,p),f) a) = findWithErr pmp "ppOcc" v
 
-{-# LINE 167 "dist/build/LOAG/Order.hs" #-}
+{-# LINE 168 "dist/build/LOAG/Order.hs" #-}
 
 {-# LINE 239 "src-ag/LOAG/Order.ag" #-}
 
@@ -243,7 +244,7 @@
                     ntid  = ((\(NT name _ _ )-> name) . fromMyTy) nt 
                     visnr = (\x-> visMap IMap.! x) (nmpr Map.! (nt <.> attr o))
                     nt    = fty Map.! (ps,child)
-{-# LINE 247 "dist/build/LOAG/Order.hs" #-}
+{-# LINE 248 "dist/build/LOAG/Order.hs" #-}
 
 {-# LINE 356 "src-ag/LOAG/Order.ag" #-}
 
@@ -325,7 +326,7 @@
            syns = map (((genA A.!) &&& id).(pmpr Map.!))$ Set.toList ss
 
 
-{-# LINE 329 "dist/build/LOAG/Order.hs" #-}
+{-# LINE 330 "dist/build/LOAG/Order.hs" #-}
 -- CGrammar ----------------------------------------------------
 -- wrapper
 data Inh_CGrammar  = Inh_CGrammar {  }
@@ -1105,13 +1106,13 @@
                  case tp_ of
                    NT nt _ _ -> Set.singleton nt
                    _         -> mempty
-                 {-# LINE 1109 "dist/build/LOAG/Order.hs"#-}
+                 {-# LINE 1110 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule33 #-}
    {-# LINE 34 "src-ag/ExecutionPlanCommon.ag" #-}
    rule33 = \ _isHigherOrder _refNts ->
                    {-# LINE 34 "src-ag/ExecutionPlanCommon.ag" #-}
                    if _isHigherOrder     then _refNts     else mempty
-                   {-# LINE 1115 "dist/build/LOAG/Order.hs"#-}
+                   {-# LINE 1116 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule34 #-}
    {-# LINE 35 "src-ag/ExecutionPlanCommon.ag" #-}
    rule34 = \ kind_ ->
@@ -1119,7 +1120,7 @@
                         case kind_ of
                           ChildSyntax -> False
                           _           -> True
-                        {-# LINE 1123 "dist/build/LOAG/Order.hs"#-}
+                        {-# LINE 1124 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule35 #-}
    {-# LINE 95 "src-ag/ExecutionPlanCommon.ag" #-}
    rule35 = \ ((_lhsIaroundMap) :: Map Identifier [Expression]) name_ ->
@@ -1127,19 +1128,19 @@
                      case Map.lookup name_ _lhsIaroundMap of
                        Nothing -> False
                        Just as -> not (null as)
-                     {-# LINE 1131 "dist/build/LOAG/Order.hs"#-}
+                     {-# LINE 1132 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule36 #-}
    {-# LINE 123 "src-ag/ExecutionPlanCommon.ag" #-}
    rule36 = \ ((_lhsImergeMap) :: Map Identifier (Identifier, [Identifier], Expression)) name_ ->
                    {-# LINE 123 "src-ag/ExecutionPlanCommon.ag" #-}
                    maybe Nothing (\(_,ms,_) -> Just ms) $ Map.lookup name_ _lhsImergeMap
-                   {-# LINE 1137 "dist/build/LOAG/Order.hs"#-}
+                   {-# LINE 1138 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule37 #-}
    {-# LINE 124 "src-ag/ExecutionPlanCommon.ag" #-}
    rule37 = \ ((_lhsImergedChildren) :: Set Identifier) name_ ->
                    {-# LINE 124 "src-ag/ExecutionPlanCommon.ag" #-}
                    name_ `Set.member` _lhsImergedChildren
-                   {-# LINE 1143 "dist/build/LOAG/Order.hs"#-}
+                   {-# LINE 1144 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule38 #-}
    {-# LINE 135 "src-ag/ExecutionPlanCommon.ag" #-}
    rule38 = \ _hasArounds _isMerged _merges kind_ name_ tp_ ->
@@ -1147,56 +1148,56 @@
                           case tp_ of
                             NT _ _ _ -> EChild name_ tp_ kind_ _hasArounds     _merges     _isMerged
                             _        -> ETerm name_ tp_
-                          {-# LINE 1151 "dist/build/LOAG/Order.hs"#-}
+                          {-# LINE 1152 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule39 #-}
    {-# LINE 174 "src-ag/LOAG/Prepare.ag" #-}
    rule39 = \ ((_lhsIflab) :: Int) ->
                     {-# LINE 174 "src-ag/LOAG/Prepare.ag" #-}
                     _lhsIflab + 1
-                    {-# LINE 1157 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 1158 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule40 #-}
    {-# LINE 175 "src-ag/LOAG/Prepare.ag" #-}
    rule40 = \ tp_ ->
                     {-# LINE 175 "src-ag/LOAG/Prepare.ag" #-}
                     toMyTy tp_
-                    {-# LINE 1163 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 1164 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule41 #-}
    {-# LINE 177 "src-ag/LOAG/Prepare.ag" #-}
    rule41 = \ _atp ((_lhsIan) :: MyType -> MyAttributes) ((_lhsIpll) :: PLabel) name_ ->
                     {-# LINE 177 "src-ag/LOAG/Prepare.ag" #-}
                     map ((FieldAtt _atp     _lhsIpll (getName name_)) . alab)
                           $ _lhsIan _atp
-                    {-# LINE 1170 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 1171 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule42 #-}
    {-# LINE 179 "src-ag/LOAG/Prepare.ag" #-}
    rule42 = \ _flab ->
                     {-# LINE 179 "src-ag/LOAG/Prepare.ag" #-}
                     _flab
-                    {-# LINE 1176 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 1177 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule43 #-}
    {-# LINE 180 "src-ag/LOAG/Prepare.ag" #-}
    rule43 = \ name_ ->
                     {-# LINE 180 "src-ag/LOAG/Prepare.ag" #-}
                     getName name_
-                    {-# LINE 1182 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 1183 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule44 #-}
    {-# LINE 181 "src-ag/LOAG/Prepare.ag" #-}
    rule44 = \ _ident ((_lhsIpll) :: PLabel) ->
                     {-# LINE 181 "src-ag/LOAG/Prepare.ag" #-}
                     (_lhsIpll, _ident    )
-                    {-# LINE 1188 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 1189 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule45 #-}
    {-# LINE 182 "src-ag/LOAG/Prepare.ag" #-}
    rule45 = \ _atp _label ((_lhsIain) :: MyType -> MyAttributes) ->
                     {-# LINE 182 "src-ag/LOAG/Prepare.ag" #-}
                     Set.fromList $ handAllOut _label     $ _lhsIain _atp
-                    {-# LINE 1194 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 1195 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule46 #-}
    {-# LINE 183 "src-ag/LOAG/Prepare.ag" #-}
    rule46 = \ _atp _label ((_lhsIasn) :: MyType -> MyAttributes) ->
                     {-# LINE 183 "src-ag/LOAG/Prepare.ag" #-}
                     Set.fromList $ handAllOut _label     $ _lhsIasn _atp
-                    {-# LINE 1200 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 1201 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule47 #-}
    {-# LINE 184 "src-ag/LOAG/Prepare.ag" #-}
    rule47 = \ _foccsI _foccsS _label ->
@@ -1204,7 +1205,7 @@
                     if Set.null _foccsI     && Set.null _foccsS
                           then Map.empty
                           else Map.singleton _label     (_foccsS    ,_foccsI    )
-                    {-# LINE 1208 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 1209 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule48 #-}
    {-# LINE 187 "src-ag/LOAG/Prepare.ag" #-}
    rule48 = \ _ident ((_lhsIpll) :: PLabel) kind_ ->
@@ -1212,19 +1213,19 @@
                     case kind_ of
                       ChildAttr -> Map.singleton _lhsIpll (Set.singleton _ident    )
                       _         -> Map.empty
-                    {-# LINE 1216 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 1217 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule49 #-}
    {-# LINE 190 "src-ag/LOAG/Prepare.ag" #-}
    rule49 = \ _atp ((_lhsIpll) :: PLabel) name_ ->
                     {-# LINE 190 "src-ag/LOAG/Prepare.ag" #-}
                     Map.singleton (_lhsIpll, getName name_) _atp
-                    {-# LINE 1222 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 1223 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule50 #-}
    {-# LINE 223 "src-ag/LOAG/Prepare.ag" #-}
    rule50 = \ name_ ->
                 {-# LINE 223 "src-ag/LOAG/Prepare.ag" #-}
                 Set.singleton $ getName name_
-                {-# LINE 1228 "dist/build/LOAG/Order.hs"#-}
+                {-# LINE 1229 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule51 #-}
    rule51 = \ ((_fattsIap) :: A_P) ->
      _fattsIap
@@ -1606,56 +1607,56 @@
    rule120 = \ ((_lhsIflab) :: Int) ->
                     {-# LINE 161 "src-ag/LOAG/Prepare.ag" #-}
                     _lhsIflab + 1
-                    {-# LINE 1610 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 1611 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule121 #-}
    {-# LINE 162 "src-ag/LOAG/Prepare.ag" #-}
    rule121 = \ ((_lhsIpll) :: PLabel) ->
                     {-# LINE 162 "src-ag/LOAG/Prepare.ag" #-}
                     fst _lhsIpll
-                    {-# LINE 1616 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 1617 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule122 #-}
    {-# LINE 164 "src-ag/LOAG/Prepare.ag" #-}
    rule122 = \ _atp ((_lhsIan) :: MyType -> MyAttributes) ((_lhsIpll) :: PLabel) ->
                     {-# LINE 164 "src-ag/LOAG/Prepare.ag" #-}
                     map ((FieldAtt _atp     _lhsIpll "lhs") . alab) $
                           _lhsIan _atp
-                    {-# LINE 1623 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 1624 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule123 #-}
    {-# LINE 166 "src-ag/LOAG/Prepare.ag" #-}
    rule123 = \ _flab ->
                     {-# LINE 166 "src-ag/LOAG/Prepare.ag" #-}
                     _flab
-                    {-# LINE 1629 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 1630 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule124 #-}
    {-# LINE 167 "src-ag/LOAG/Prepare.ag" #-}
    rule124 = \ ((_lhsIpll) :: PLabel) ->
                     {-# LINE 167 "src-ag/LOAG/Prepare.ag" #-}
                     (_lhsIpll, "lhs")
-                    {-# LINE 1635 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 1636 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule125 #-}
    {-# LINE 168 "src-ag/LOAG/Prepare.ag" #-}
    rule125 = \ _atp _label ((_lhsIain) :: MyType -> MyAttributes) ->
                     {-# LINE 168 "src-ag/LOAG/Prepare.ag" #-}
                     Set.fromList $ handAllOut _label     $ _lhsIain _atp
-                    {-# LINE 1641 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 1642 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule126 #-}
    {-# LINE 169 "src-ag/LOAG/Prepare.ag" #-}
    rule126 = \ _atp _label ((_lhsIasn) :: MyType -> MyAttributes) ->
                     {-# LINE 169 "src-ag/LOAG/Prepare.ag" #-}
                     Set.fromList $ handAllOut _label     $ _lhsIasn _atp
-                    {-# LINE 1647 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 1648 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule127 #-}
    {-# LINE 170 "src-ag/LOAG/Prepare.ag" #-}
    rule127 = \ _foccsI _foccsS _label ->
                     {-# LINE 170 "src-ag/LOAG/Prepare.ag" #-}
                     Map.singleton _label     (_foccsI    , _foccsS    )
-                    {-# LINE 1653 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 1654 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule128 #-}
    {-# LINE 171 "src-ag/LOAG/Prepare.ag" #-}
    rule128 = \ _label ((_lhsIdty) :: MyType) ->
                     {-# LINE 171 "src-ag/LOAG/Prepare.ag" #-}
                     Map.singleton _label     _lhsIdty
-                    {-# LINE 1659 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 1660 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule129 #-}
    rule129 = \ ((_fattsIap) :: A_P) ->
      _fattsIap
@@ -1772,25 +1773,25 @@
    rule148 = \ tks_ ->
                     {-# LINE 273 "src-ag/LOAG/Prepare.ag" #-}
                     HsTokensRoot tks_
-                    {-# LINE 1776 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 1777 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule149 #-}
    {-# LINE 274 "src-ag/LOAG/Prepare.ag" #-}
    rule149 = \ ((_lhsIpll) :: PLabel) ->
                     {-# LINE 274 "src-ag/LOAG/Prepare.ag" #-}
                     _lhsIpll
-                    {-# LINE 1782 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 1783 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule150 #-}
    {-# LINE 275 "src-ag/LOAG/Prepare.ag" #-}
    rule150 = \ ((_lhsIpts) :: Set.Set (FLabel)) ->
                     {-# LINE 275 "src-ag/LOAG/Prepare.ag" #-}
                     _lhsIpts
-                    {-# LINE 1788 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 1789 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule151 #-}
    {-# LINE 276 "src-ag/LOAG/Prepare.ag" #-}
    rule151 = \ ((_tokensIused) :: Set.Set MyOccurrence) ->
                     {-# LINE 276 "src-ag/LOAG/Prepare.ag" #-}
                     _tokensIused
-                    {-# LINE 1794 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 1795 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule152 #-}
    rule152 = \ pos_ tks_ ->
      Expression pos_ tks_
@@ -1878,61 +1879,61 @@
    rule156 = \ ((_lhsIolab) :: Int) ->
                     {-# LINE 193 "src-ag/LOAG/Prepare.ag" #-}
                     _lhsIolab + 1
-                    {-# LINE 1882 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 1883 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule157 #-}
    {-# LINE 194 "src-ag/LOAG/Prepare.ag" #-}
    rule157 = \ _att ((_lhsInmprf) :: NMP_R) ->
                     {-# LINE 194 "src-ag/LOAG/Prepare.ag" #-}
                     findWithErr _lhsInmprf "getting attr label" _att
-                    {-# LINE 1888 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 1889 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule158 #-}
    {-# LINE 195 "src-ag/LOAG/Prepare.ag" #-}
    rule158 = \ a_ t_ ->
                     {-# LINE 195 "src-ag/LOAG/Prepare.ag" #-}
                     t_ <.> a_
-                    {-# LINE 1894 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 1895 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule159 #-}
    {-# LINE 196 "src-ag/LOAG/Prepare.ag" #-}
    rule159 = \ a_ f_ p_ ->
                     {-# LINE 196 "src-ag/LOAG/Prepare.ag" #-}
                     (p_, f_) >.< a_
-                    {-# LINE 1900 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 1901 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule160 #-}
    {-# LINE 197 "src-ag/LOAG/Prepare.ag" #-}
    rule160 = \ _occ _olab ->
                     {-# LINE 197 "src-ag/LOAG/Prepare.ag" #-}
                     Map.singleton _olab     _occ
-                    {-# LINE 1906 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 1907 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule161 #-}
    {-# LINE 198 "src-ag/LOAG/Prepare.ag" #-}
    rule161 = \ _occ _olab ->
                     {-# LINE 198 "src-ag/LOAG/Prepare.ag" #-}
                     Map.singleton _occ      _olab
-                    {-# LINE 1912 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 1913 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule162 #-}
    {-# LINE 199 "src-ag/LOAG/Prepare.ag" #-}
    rule162 = \ _alab _olab ->
                     {-# LINE 199 "src-ag/LOAG/Prepare.ag" #-}
                     Map.singleton _alab     [_olab    ]
-                    {-# LINE 1918 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 1919 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule163 #-}
    {-# LINE 200 "src-ag/LOAG/Prepare.ag" #-}
    rule163 = \ _alab _olab ->
                     {-# LINE 200 "src-ag/LOAG/Prepare.ag" #-}
                     Map.singleton _olab     _alab
-                    {-# LINE 1924 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 1925 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule164 #-}
    {-# LINE 201 "src-ag/LOAG/Prepare.ag" #-}
    rule164 = \ _occ p_ ->
                     {-# LINE 201 "src-ag/LOAG/Prepare.ag" #-}
                     Map.singleton p_ [_occ    ]
-                    {-# LINE 1930 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 1931 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule165 #-}
    {-# LINE 202 "src-ag/LOAG/Prepare.ag" #-}
    rule165 = \ ((_lhsIflab) :: Int) _olab ->
                     {-# LINE 202 "src-ag/LOAG/Prepare.ag" #-}
                     [(_olab    , _lhsIflab)]
-                    {-# LINE 1936 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 1937 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule166 #-}
    rule166 = \  (_ :: ()) ->
      Map.empty
@@ -2264,49 +2265,49 @@
    rule205 = \ ((_nontsIntDeps) :: Map NontermIdent (Set NontermIdent)) ->
                             {-# LINE 40 "src-ag/ExecutionPlanCommon.ag" #-}
                             closeMap _nontsIntDeps
-                            {-# LINE 2268 "dist/build/LOAG/Order.hs"#-}
+                            {-# LINE 2269 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule206 #-}
    {-# LINE 41 "src-ag/ExecutionPlanCommon.ag" #-}
    rule206 = \ ((_nontsIntHoDeps) :: Map NontermIdent (Set NontermIdent)) ->
                             {-# LINE 41 "src-ag/ExecutionPlanCommon.ag" #-}
                             closeMap _nontsIntHoDeps
-                            {-# LINE 2274 "dist/build/LOAG/Order.hs"#-}
+                            {-# LINE 2275 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule207 #-}
    {-# LINE 42 "src-ag/ExecutionPlanCommon.ag" #-}
    rule207 = \ _closedHoNtDeps ->
                             {-# LINE 42 "src-ag/ExecutionPlanCommon.ag" #-}
                             revDeps _closedHoNtDeps
-                            {-# LINE 2280 "dist/build/LOAG/Order.hs"#-}
+                            {-# LINE 2281 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule208 #-}
    {-# LINE 51 "src-ag/ExecutionPlanCommon.ag" #-}
    rule208 = \ contextMap_ ->
                           {-# LINE 51 "src-ag/ExecutionPlanCommon.ag" #-}
                           contextMap_
-                          {-# LINE 2286 "dist/build/LOAG/Order.hs"#-}
+                          {-# LINE 2287 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule209 #-}
    {-# LINE 92 "src-ag/ExecutionPlanCommon.ag" #-}
    rule209 = \ aroundsMap_ ->
                       {-# LINE 92 "src-ag/ExecutionPlanCommon.ag" #-}
                       aroundsMap_
-                      {-# LINE 2292 "dist/build/LOAG/Order.hs"#-}
+                      {-# LINE 2293 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule210 #-}
    {-# LINE 117 "src-ag/ExecutionPlanCommon.ag" #-}
    rule210 = \ mergeMap_ ->
                      {-# LINE 117 "src-ag/ExecutionPlanCommon.ag" #-}
                      mergeMap_
-                     {-# LINE 2298 "dist/build/LOAG/Order.hs"#-}
+                     {-# LINE 2299 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule211 #-}
    {-# LINE 9 "src-ag/ExecutionPlanPre.ag" #-}
    rule211 = \  (_ :: ()) ->
                                   {-# LINE 9 "src-ag/ExecutionPlanPre.ag" #-}
                                   0
-                                  {-# LINE 2304 "dist/build/LOAG/Order.hs"#-}
+                                  {-# LINE 2305 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule212 #-}
    {-# LINE 38 "src-ag/LOAG/Prepare.ag" #-}
    rule212 = \ ((_nontsIpmp) :: PMP) ->
                  {-# LINE 38 "src-ag/LOAG/Prepare.ag" #-}
                  if Map.null _nontsIpmp then 1 else fst $ Map.findMin _nontsIpmp
-                 {-# LINE 2310 "dist/build/LOAG/Order.hs"#-}
+                 {-# LINE 2311 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule213 #-}
    {-# LINE 40 "src-ag/LOAG/Prepare.ag" #-}
    rule213 = \ _ain _an _asn _initO _nmp _nmpr ((_nontsIap) :: A_P) ((_nontsIfieldMap) :: FMap) ((_nontsIfsInP) :: FsInP) ((_nontsIfty) :: FTY) ((_nontsIgen) :: Map Int Int) ((_nontsIinss) :: Map Int [Int]) ((_nontsIofld) :: [(Int, Int)]) ((_nontsIpmp) :: PMP) ((_nontsIpmpr) :: PMP_R) ((_nontsIps) :: [PLabel]) _sfp ->
@@ -2320,145 +2321,145 @@
                   Map.toList $ _nontsIinss)
              (A.array (_initO    , _initO     + length _nontsIofld) $
                   _nontsIofld) _nontsIfty _nontsIfieldMap _nontsIfsInP
-          {-# LINE 2324 "dist/build/LOAG/Order.hs"#-}
+          {-# LINE 2325 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule214 #-}
    {-# LINE 49 "src-ag/LOAG/Prepare.ag" #-}
    rule214 = \ _atts ->
                  {-# LINE 49 "src-ag/LOAG/Prepare.ag" #-}
                  Map.fromList $ zip [1..] _atts
-                 {-# LINE 2330 "dist/build/LOAG/Order.hs"#-}
+                 {-# LINE 2331 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule215 #-}
    {-# LINE 50 "src-ag/LOAG/Prepare.ag" #-}
    rule215 = \ _atts ->
                  {-# LINE 50 "src-ag/LOAG/Prepare.ag" #-}
                  Map.fromList $ zip _atts     [1..]
-                 {-# LINE 2336 "dist/build/LOAG/Order.hs"#-}
+                 {-# LINE 2337 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule216 #-}
    {-# LINE 51 "src-ag/LOAG/Prepare.ag" #-}
    rule216 = \ _ain _asn ->
                  {-# LINE 51 "src-ag/LOAG/Prepare.ag" #-}
                  Map.unionWith (++) _ain     _asn
-                 {-# LINE 2342 "dist/build/LOAG/Order.hs"#-}
+                 {-# LINE 2343 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule217 #-}
    {-# LINE 52 "src-ag/LOAG/Prepare.ag" #-}
    rule217 = \ ((_nontsIinhs) :: AI_N) ->
                  {-# LINE 52 "src-ag/LOAG/Prepare.ag" #-}
                  _nontsIinhs
-                 {-# LINE 2348 "dist/build/LOAG/Order.hs"#-}
+                 {-# LINE 2349 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule218 #-}
    {-# LINE 53 "src-ag/LOAG/Prepare.ag" #-}
    rule218 = \ ((_nontsIsyns) :: AS_N) ->
                  {-# LINE 53 "src-ag/LOAG/Prepare.ag" #-}
                  _nontsIsyns
-                 {-# LINE 2354 "dist/build/LOAG/Order.hs"#-}
+                 {-# LINE 2355 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule219 #-}
    {-# LINE 54 "src-ag/LOAG/Prepare.ag" #-}
    rule219 = \ _an ->
                  {-# LINE 54 "src-ag/LOAG/Prepare.ag" #-}
                  concat $ Map.elems _an
-                 {-# LINE 2360 "dist/build/LOAG/Order.hs"#-}
+                 {-# LINE 2361 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule220 #-}
    {-# LINE 55 "src-ag/LOAG/Prepare.ag" #-}
    rule220 = \ ((_nontsIap) :: A_P) ->
                  {-# LINE 55 "src-ag/LOAG/Prepare.ag" #-}
                  concat $ Map.elems _nontsIap
-                 {-# LINE 2366 "dist/build/LOAG/Order.hs"#-}
+                 {-# LINE 2367 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule221 #-}
    {-# LINE 56 "src-ag/LOAG/Prepare.ag" #-}
    rule221 = \ manualAttrOrderMap_ ->
                    {-# LINE 56 "src-ag/LOAG/Prepare.ag" #-}
                    manualAttrOrderMap_
-                   {-# LINE 2372 "dist/build/LOAG/Order.hs"#-}
+                   {-# LINE 2373 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule222 #-}
    {-# LINE 87 "src-ag/LOAG/Prepare.ag" #-}
    rule222 = \ _ain ->
                    {-# LINE 87 "src-ag/LOAG/Prepare.ag" #-}
                    map2F _ain
-                   {-# LINE 2378 "dist/build/LOAG/Order.hs"#-}
+                   {-# LINE 2379 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule223 #-}
    {-# LINE 88 "src-ag/LOAG/Prepare.ag" #-}
    rule223 = \ _asn ->
                    {-# LINE 88 "src-ag/LOAG/Prepare.ag" #-}
                    map2F _asn
-                   {-# LINE 2384 "dist/build/LOAG/Order.hs"#-}
+                   {-# LINE 2385 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule224 #-}
    {-# LINE 89 "src-ag/LOAG/Prepare.ag" #-}
    rule224 = \ ((_nontsIpmp) :: PMP) ->
                     {-# LINE 89 "src-ag/LOAG/Prepare.ag" #-}
                     _nontsIpmp
-                    {-# LINE 2390 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 2391 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule225 #-}
    {-# LINE 90 "src-ag/LOAG/Prepare.ag" #-}
    rule225 = \ ((_nontsIpmpr) :: PMP_R) ->
                     {-# LINE 90 "src-ag/LOAG/Prepare.ag" #-}
                     _nontsIpmpr
-                    {-# LINE 2396 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 2397 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule226 #-}
    {-# LINE 91 "src-ag/LOAG/Prepare.ag" #-}
    rule226 = \ ((_nontsIlfp) :: SF_P) ->
                     {-# LINE 91 "src-ag/LOAG/Prepare.ag" #-}
                     _nontsIlfp
-                    {-# LINE 2402 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 2403 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule227 #-}
    {-# LINE 92 "src-ag/LOAG/Prepare.ag" #-}
    rule227 = \ ((_nontsIhoMap) :: HOMap) ->
                     {-# LINE 92 "src-ag/LOAG/Prepare.ag" #-}
                     _nontsIhoMap
-                    {-# LINE 2408 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 2409 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule228 #-}
    {-# LINE 93 "src-ag/LOAG/Prepare.ag" #-}
    rule228 = \ ((_nontsIfty) :: FTY) ->
                     {-# LINE 93 "src-ag/LOAG/Prepare.ag" #-}
                     _nontsIfty
-                    {-# LINE 2414 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 2415 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule229 #-}
    {-# LINE 94 "src-ag/LOAG/Prepare.ag" #-}
    rule229 = \ ((_nontsIfty) :: FTY) ->
                     {-# LINE 94 "src-ag/LOAG/Prepare.ag" #-}
                     _nontsIfty
-                    {-# LINE 2420 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 2421 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule230 #-}
    {-# LINE 103 "src-ag/LOAG/Prepare.ag" #-}
    rule230 = \ ((_nontsIps) :: [PLabel]) ->
                 {-# LINE 103 "src-ag/LOAG/Prepare.ag" #-}
                 _nontsIps
-                {-# LINE 2426 "dist/build/LOAG/Order.hs"#-}
+                {-# LINE 2427 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule231 #-}
    {-# LINE 150 "src-ag/LOAG/Prepare.ag" #-}
    rule231 = \ _an ->
                  {-# LINE 150 "src-ag/LOAG/Prepare.ag" #-}
                  map2F _an
-                 {-# LINE 2432 "dist/build/LOAG/Order.hs"#-}
+                 {-# LINE 2433 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule232 #-}
    {-# LINE 151 "src-ag/LOAG/Prepare.ag" #-}
    rule232 = \ _nmpr ->
                    {-# LINE 151 "src-ag/LOAG/Prepare.ag" #-}
                    _nmpr
-                   {-# LINE 2438 "dist/build/LOAG/Order.hs"#-}
+                   {-# LINE 2439 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule233 #-}
    {-# LINE 152 "src-ag/LOAG/Prepare.ag" #-}
    rule233 = \ _nmp ->
                    {-# LINE 152 "src-ag/LOAG/Prepare.ag" #-}
                    if Map.null _nmp     then 0 else (fst $ Map.findMax _nmp    )
-                   {-# LINE 2444 "dist/build/LOAG/Order.hs"#-}
+                   {-# LINE 2445 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule234 #-}
    {-# LINE 153 "src-ag/LOAG/Prepare.ag" #-}
    rule234 = \  (_ :: ()) ->
                    {-# LINE 153 "src-ag/LOAG/Prepare.ag" #-}
                    0
-                   {-# LINE 2450 "dist/build/LOAG/Order.hs"#-}
+                   {-# LINE 2451 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule235 #-}
    {-# LINE 207 "src-ag/LOAG/Prepare.ag" #-}
    rule235 = \ ((_nontsIlfp) :: SF_P) ((_nontsIsfp) :: SF_P) ->
                  {-# LINE 207 "src-ag/LOAG/Prepare.ag" #-}
                  repLocRefs _nontsIlfp $ addHigherOrders _nontsIlfp _nontsIsfp
-                 {-# LINE 2456 "dist/build/LOAG/Order.hs"#-}
+                 {-# LINE 2457 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule236 #-}
    {-# LINE 54 "src-ag/LOAG/Order.ag" #-}
    rule236 = \ _schedRes ->
                    {-# LINE 54 "src-ag/LOAG/Order.ag" #-}
                    either Seq.singleton (const Seq.empty) _schedRes
-                   {-# LINE 2462 "dist/build/LOAG/Order.hs"#-}
+                   {-# LINE 2463 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule237 #-}
    {-# LINE 55 "src-ag/LOAG/Order.ag" #-}
    rule237 = \ ((_lhsIoptions) :: Options) ((_nontsIpmp) :: PMP) _schedRes ->
@@ -2466,25 +2467,25 @@
                    case either (const []) trd' _schedRes     of
                       []  -> Nothing
                       ads -> Just $ ppAds _lhsIoptions _nontsIpmp ads
-                   {-# LINE 2470 "dist/build/LOAG/Order.hs"#-}
+                   {-# LINE 2471 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule238 #-}
    {-# LINE 58 "src-ag/LOAG/Order.ag" #-}
    rule238 = \ ((_nontsIenonts) :: ENonterminals) derivings_ typeSyns_ wrappers_ ->
                    {-# LINE 58 "src-ag/LOAG/Order.ag" #-}
                    ExecutionPlan _nontsIenonts typeSyns_ wrappers_ derivings_
-                   {-# LINE 2476 "dist/build/LOAG/Order.hs"#-}
+                   {-# LINE 2477 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule239 #-}
    {-# LINE 60 "src-ag/LOAG/Order.ag" #-}
    rule239 = \ _schedRes ->
                       {-# LINE 60 "src-ag/LOAG/Order.ag" #-}
                       either (const Map.empty) snd' _schedRes
-                      {-# LINE 2482 "dist/build/LOAG/Order.hs"#-}
+                      {-# LINE 2483 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule240 #-}
    {-# LINE 61 "src-ag/LOAG/Order.ag" #-}
    rule240 = \ _schedRes ->
                       {-# LINE 61 "src-ag/LOAG/Order.ag" #-}
                       either (error "no tdp") (fromJust.fst') _schedRes
-                      {-# LINE 2488 "dist/build/LOAG/Order.hs"#-}
+                      {-# LINE 2489 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule241 #-}
    {-# LINE 63 "src-ag/LOAG/Order.ag" #-}
    rule241 = \ _ag ((_lhsIoptions) :: Options) _loagRes ((_nontsIads) :: [Edge]) _self ((_smfIself) :: LOAGRep) ->
@@ -2494,38 +2495,38 @@
                                   then AOAG.schedule _smfIself _self _ag     _nontsIads
                                   else _loagRes
                           else Right (Nothing,Map.empty,[])
-                       {-# LINE 2498 "dist/build/LOAG/Order.hs"#-}
+                       {-# LINE 2499 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule242 #-}
    {-# LINE 68 "src-ag/LOAG/Order.ag" #-}
    rule242 = \ _ag ((_lhsIoptions) :: Options) ->
                     {-# LINE 68 "src-ag/LOAG/Order.ag" #-}
                     let putStrLn s = when (verbose _lhsIoptions) (IO.putStrLn s)
                     in  Right $ unsafePerformIO $ scheduleLOAG _ag     putStrLn _lhsIoptions
-                    {-# LINE 2505 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 2506 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule243 #-}
    {-# LINE 70 "src-ag/LOAG/Order.ag" #-}
    rule243 = \ _self ((_smfIself) :: LOAGRep) ->
                {-# LINE 70 "src-ag/LOAG/Order.ag" #-}
                repToAg _smfIself _self
-               {-# LINE 2511 "dist/build/LOAG/Order.hs"#-}
+               {-# LINE 2512 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule244 #-}
    {-# LINE 72 "src-ag/LOAG/Order.ag" #-}
    rule244 = \ _schedRes ->
                       {-# LINE 72 "src-ag/LOAG/Order.ag" #-}
                       either (const []) trd' _schedRes
-                      {-# LINE 2517 "dist/build/LOAG/Order.hs"#-}
+                      {-# LINE 2518 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule245 #-}
    {-# LINE 133 "src-ag/LOAG/Order.ag" #-}
    rule245 = \ ((_nontsIvisMap) :: IMap.IntMap Int) ->
                               {-# LINE 133 "src-ag/LOAG/Order.ag" #-}
                               _nontsIvisMap
-                              {-# LINE 2523 "dist/build/LOAG/Order.hs"#-}
+                              {-# LINE 2524 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule246 #-}
    {-# LINE 134 "src-ag/LOAG/Order.ag" #-}
    rule246 = \  (_ :: ()) ->
                                {-# LINE 134 "src-ag/LOAG/Order.ag" #-}
                                0
-                               {-# LINE 2529 "dist/build/LOAG/Order.hs"#-}
+                               {-# LINE 2530 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule247 #-}
    rule247 = \ ((_nontsIinhmap) :: Map.Map NontermIdent Attributes) ->
      _nontsIinhmap
@@ -2615,7 +2616,7 @@
             True  -> Set.empty
             False -> Set.singleton $ (_lhsIpll, getName _LOC) >.<
                           (getName var_, drhs _LOC)
-          {-# LINE 2619 "dist/build/LOAG/Order.hs"#-}
+          {-# LINE 2620 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule258 #-}
    rule258 = \ pos_ rdesc_ var_ ->
      AGLocal var_ pos_ rdesc_
@@ -2643,7 +2644,7 @@
                  {-# LINE 289 "src-ag/LOAG/Prepare.ag" #-}
                  Set.singleton $ (_lhsIpll, getName field_) >.<
                                   (getName attr_, drhs field_)
-                 {-# LINE 2647 "dist/build/LOAG/Order.hs"#-}
+                 {-# LINE 2648 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule261 #-}
    rule261 = \ attr_ field_ pos_ rdesc_ ->
      AGField field_ attr_ pos_ rdesc_
@@ -3038,51 +3039,51 @@
    rule294 = \ ((_lhsInmp) :: NMP) inhAttr_ ->
                    {-# LINE 225 "src-ag/LOAG/Order.ag" #-}
                    Map.keysSet$ Map.unions $ map (vertexToAttr _lhsInmp) inhAttr_
-                   {-# LINE 3042 "dist/build/LOAG/Order.hs"#-}
+                   {-# LINE 3043 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule295 #-}
    {-# LINE 226 "src-ag/LOAG/Order.ag" #-}
    rule295 = \ ((_lhsInmp) :: NMP) synAttr_ ->
                    {-# LINE 226 "src-ag/LOAG/Order.ag" #-}
                    Map.keysSet$ Map.unions $ map (vertexToAttr _lhsInmp) synAttr_
-                   {-# LINE 3048 "dist/build/LOAG/Order.hs"#-}
+                   {-# LINE 3049 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule296 #-}
    {-# LINE 227 "src-ag/LOAG/Order.ag" #-}
    rule296 = \ inhOccs_ ->
                    {-# LINE 227 "src-ag/LOAG/Order.ag" #-}
                    maybe (error "segment not instantiated") id inhOccs_
-                   {-# LINE 3054 "dist/build/LOAG/Order.hs"#-}
+                   {-# LINE 3055 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule297 #-}
    {-# LINE 228 "src-ag/LOAG/Order.ag" #-}
    rule297 = \ synOccs_ ->
                    {-# LINE 228 "src-ag/LOAG/Order.ag" #-}
                    maybe (error "segment not instantiated") id synOccs_
-                   {-# LINE 3060 "dist/build/LOAG/Order.hs"#-}
+                   {-# LINE 3061 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule298 #-}
    {-# LINE 229 "src-ag/LOAG/Order.ag" #-}
    rule298 = \ visnr_ ->
                    {-# LINE 229 "src-ag/LOAG/Order.ag" #-}
                    visnr_
-                   {-# LINE 3066 "dist/build/LOAG/Order.hs"#-}
+                   {-# LINE 3067 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule299 #-}
    {-# LINE 230 "src-ag/LOAG/Order.ag" #-}
    rule299 = \ ((_lhsIoptions) :: Options) ->
                    {-# LINE 230 "src-ag/LOAG/Order.ag" #-}
                    if monadic _lhsIoptions then VisitMonadic else VisitPure True
-                   {-# LINE 3072 "dist/build/LOAG/Order.hs"#-}
+                   {-# LINE 3073 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule300 #-}
    {-# LINE 231 "src-ag/LOAG/Order.ag" #-}
    rule300 = \ _inhs _kind ((_lhsIvisitnum) :: Int) _steps _syns ->
                       {-# LINE 231 "src-ag/LOAG/Order.ag" #-}
                       Visit _lhsIvisitnum _lhsIvisitnum (_lhsIvisitnum+1)
                             _inhs     _syns     _steps     _kind
-                      {-# LINE 3079 "dist/build/LOAG/Order.hs"#-}
+                      {-# LINE 3080 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule301 #-}
    {-# LINE 233 "src-ag/LOAG/Order.ag" #-}
    rule301 = \ ((_lhsIoptions) :: Options) _vss ->
                       {-# LINE 233 "src-ag/LOAG/Order.ag" #-}
                       if monadic _lhsIoptions
                           then [Sim _vss    ] else [PureGroup _vss     True]
-                      {-# LINE 3086 "dist/build/LOAG/Order.hs"#-}
+                      {-# LINE 3087 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule302 #-}
    {-# LINE 235 "src-ag/LOAG/Order.ag" #-}
    rule302 = \ ((_lhsIdone) ::  (Set.Set MyOccurrence, Set.Set FLabel
@@ -3091,7 +3092,7 @@
                              (runST $ getVss _lhsIdone _lhsIps _lhsItdp _synsO
                               _lhsIlfpf _lhsInmprf _lhsIpmpf _lhsIpmprf _lhsIfty
                               _lhsIvisMapf _lhsIruleMap _lhsIhoMapf)
-                             {-# LINE 3095 "dist/build/LOAG/Order.hs"#-}
+                             {-# LINE 3096 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule303 #-}
    rule303 = \ inhAttr_ inhOccs_ synAttr_ synOccs_ visnr_ ->
      MySegment visnr_ inhAttr_ synAttr_ inhOccs_ synOccs_
@@ -3196,14 +3197,14 @@
                                                , Set.Set Identifier, Set.Set (FLabel,Int))) ->
                         {-# LINE 220 "src-ag/LOAG/Order.ag" #-}
                         _lhsIdone
-                        {-# LINE 3200 "dist/build/LOAG/Order.hs"#-}
+                        {-# LINE 3201 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule308 #-}
    {-# LINE 221 "src-ag/LOAG/Order.ag" #-}
    rule308 = \ ((_hdIdone) ::  (Set.Set MyOccurrence, Set.Set FLabel
                                               ,Set.Set Identifier, Set.Set (FLabel,Int))) ->
                         {-# LINE 221 "src-ag/LOAG/Order.ag" #-}
                         _hdIdone
-                        {-# LINE 3207 "dist/build/LOAG/Order.hs"#-}
+                        {-# LINE 3208 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule309 #-}
    rule309 = \ ((_hdIevisits) :: Visit) ((_tlIevisits) :: Visits) ->
      _hdIevisits : _tlIevisits
@@ -3490,43 +3491,43 @@
    rule347 = \ ((_prodsIrefNts) :: Set NontermIdent) nt_ ->
                             {-# LINE 16 "src-ag/ExecutionPlanCommon.ag" #-}
                             Map.singleton nt_ _prodsIrefNts
-                            {-# LINE 3494 "dist/build/LOAG/Order.hs"#-}
+                            {-# LINE 3495 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule348 #-}
    {-# LINE 17 "src-ag/ExecutionPlanCommon.ag" #-}
    rule348 = \ ((_prodsIrefHoNts) :: Set NontermIdent) nt_ ->
                             {-# LINE 17 "src-ag/ExecutionPlanCommon.ag" #-}
                             Map.singleton nt_ _prodsIrefHoNts
-                            {-# LINE 3500 "dist/build/LOAG/Order.hs"#-}
+                            {-# LINE 3501 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule349 #-}
    {-# LINE 19 "src-ag/ExecutionPlanCommon.ag" #-}
    rule349 = \ ((_lhsIclosedNtDeps) :: Map NontermIdent (Set NontermIdent)) nt_ ->
                             {-# LINE 19 "src-ag/ExecutionPlanCommon.ag" #-}
                             Map.findWithDefault Set.empty nt_ _lhsIclosedNtDeps
-                            {-# LINE 3506 "dist/build/LOAG/Order.hs"#-}
+                            {-# LINE 3507 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule350 #-}
    {-# LINE 20 "src-ag/ExecutionPlanCommon.ag" #-}
    rule350 = \ ((_lhsIclosedHoNtDeps) :: Map NontermIdent (Set NontermIdent)) nt_ ->
                             {-# LINE 20 "src-ag/ExecutionPlanCommon.ag" #-}
                             Map.findWithDefault Set.empty nt_ _lhsIclosedHoNtDeps
-                            {-# LINE 3512 "dist/build/LOAG/Order.hs"#-}
+                            {-# LINE 3513 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule351 #-}
    {-# LINE 21 "src-ag/ExecutionPlanCommon.ag" #-}
    rule351 = \ ((_lhsIclosedHoNtRevDeps) :: Map NontermIdent (Set NontermIdent)) nt_ ->
                             {-# LINE 21 "src-ag/ExecutionPlanCommon.ag" #-}
                             Map.findWithDefault Set.empty nt_ _lhsIclosedHoNtRevDeps
-                            {-# LINE 3518 "dist/build/LOAG/Order.hs"#-}
+                            {-# LINE 3519 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule352 #-}
    {-# LINE 23 "src-ag/ExecutionPlanCommon.ag" #-}
    rule352 = \ _closedNtDeps nt_ ->
                             {-# LINE 23 "src-ag/ExecutionPlanCommon.ag" #-}
                             nt_ `Set.member` _closedNtDeps
-                            {-# LINE 3524 "dist/build/LOAG/Order.hs"#-}
+                            {-# LINE 3525 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule353 #-}
    {-# LINE 24 "src-ag/ExecutionPlanCommon.ag" #-}
    rule353 = \ _closedHoNtDeps nt_ ->
                             {-# LINE 24 "src-ag/ExecutionPlanCommon.ag" #-}
                             nt_ `Set.member` _closedHoNtDeps
-                            {-# LINE 3530 "dist/build/LOAG/Order.hs"#-}
+                            {-# LINE 3531 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule354 #-}
    {-# LINE 25 "src-ag/ExecutionPlanCommon.ag" #-}
    rule354 = \ _closedHoNtDeps _closedHoNtRevDeps _nontrivAcyc ->
@@ -3535,57 +3536,57 @@
                                             , hoNtRevDeps         = _closedHoNtRevDeps
                                             , hoAcyclic           = _nontrivAcyc
                                             }
-                            {-# LINE 3539 "dist/build/LOAG/Order.hs"#-}
+                            {-# LINE 3540 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule355 #-}
    {-# LINE 54 "src-ag/ExecutionPlanCommon.ag" #-}
    rule355 = \ ((_lhsIclassContexts) :: ContextMap) nt_ ->
                         {-# LINE 54 "src-ag/ExecutionPlanCommon.ag" #-}
                         Map.findWithDefault [] nt_ _lhsIclassContexts
-                        {-# LINE 3545 "dist/build/LOAG/Order.hs"#-}
+                        {-# LINE 3546 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule356 #-}
    {-# LINE 88 "src-ag/ExecutionPlanCommon.ag" #-}
    rule356 = \ ((_lhsIaroundMap) :: Map NontermIdent (Map ConstructorIdent (Map Identifier [Expression]))) nt_ ->
                                                  {-# LINE 88 "src-ag/ExecutionPlanCommon.ag" #-}
                                                  Map.findWithDefault Map.empty nt_ _lhsIaroundMap
-                                                 {-# LINE 3551 "dist/build/LOAG/Order.hs"#-}
+                                                 {-# LINE 3552 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule357 #-}
    {-# LINE 113 "src-ag/ExecutionPlanCommon.ag" #-}
    rule357 = \ ((_lhsImergeMap) :: Map NontermIdent (Map ConstructorIdent (Map Identifier (Identifier, [Identifier], Expression)))) nt_ ->
                                                 {-# LINE 113 "src-ag/ExecutionPlanCommon.ag" #-}
                                                 Map.findWithDefault Map.empty nt_ _lhsImergeMap
-                                                {-# LINE 3557 "dist/build/LOAG/Order.hs"#-}
+                                                {-# LINE 3558 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule358 #-}
    {-# LINE 149 "src-ag/ExecutionPlanCommon.ag" #-}
    rule358 = \ inh_ nt_ ->
                                {-# LINE 149 "src-ag/ExecutionPlanCommon.ag" #-}
                                Map.singleton nt_ inh_
-                               {-# LINE 3563 "dist/build/LOAG/Order.hs"#-}
+                               {-# LINE 3564 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule359 #-}
    {-# LINE 150 "src-ag/ExecutionPlanCommon.ag" #-}
    rule359 = \ nt_ syn_ ->
                                {-# LINE 150 "src-ag/ExecutionPlanCommon.ag" #-}
                                Map.singleton nt_ syn_
-                               {-# LINE 3569 "dist/build/LOAG/Order.hs"#-}
+                               {-# LINE 3570 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule360 #-}
    {-# LINE 159 "src-ag/ExecutionPlanCommon.ag" #-}
    rule360 = \ ((_prodsIlocalSigMap) :: Map.Map ConstructorIdent (Map.Map Identifier Type)) nt_ ->
                                                    {-# LINE 159 "src-ag/ExecutionPlanCommon.ag" #-}
                                                    Map.singleton nt_ _prodsIlocalSigMap
-                                                   {-# LINE 3575 "dist/build/LOAG/Order.hs"#-}
+                                                   {-# LINE 3576 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule361 #-}
    {-# LINE 65 "src-ag/LOAG/Prepare.ag" #-}
    rule361 = \ inh_ nt_ ->
                  {-# LINE 65 "src-ag/LOAG/Prepare.ag" #-}
                  let dty = TyData (getName nt_)
                   in Map.singleton dty (toMyAttr Inh dty inh_)
-                 {-# LINE 3582 "dist/build/LOAG/Order.hs"#-}
+                 {-# LINE 3583 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule362 #-}
    {-# LINE 67 "src-ag/LOAG/Prepare.ag" #-}
    rule362 = \ nt_ syn_ ->
                  {-# LINE 67 "src-ag/LOAG/Prepare.ag" #-}
                  let dty = TyData (getName nt_)
                   in Map.singleton dty (toMyAttr Syn dty syn_)
-                 {-# LINE 3589 "dist/build/LOAG/Order.hs"#-}
+                 {-# LINE 3590 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule363 #-}
    {-# LINE 69 "src-ag/LOAG/Prepare.ag" #-}
    rule363 = \ ((_lhsIaugM) :: Map.Map Identifier (Map.Map Identifier (Set.Set Dependency))) nt_ ->
@@ -3593,51 +3594,51 @@
                    case Map.lookup nt_ _lhsIaugM of
                       Nothing -> Map.empty
                       Just a  -> a
-                   {-# LINE 3597 "dist/build/LOAG/Order.hs"#-}
+                   {-# LINE 3598 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule364 #-}
    {-# LINE 131 "src-ag/LOAG/Prepare.ag" #-}
    rule364 = \ nt_ ->
                  {-# LINE 131 "src-ag/LOAG/Prepare.ag" #-}
                  TyData (getName nt_)
-                 {-# LINE 3603 "dist/build/LOAG/Order.hs"#-}
+                 {-# LINE 3604 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule365 #-}
    {-# LINE 82 "src-ag/LOAG/Order.ag" #-}
    rule365 = \ ((_prodsIfdps) :: Map.Map ConstructorIdent (Set Dependency)) nt_ ->
                     {-# LINE 82 "src-ag/LOAG/Order.ag" #-}
                     Map.singleton nt_ _prodsIfdps
-                    {-# LINE 3609 "dist/build/LOAG/Order.hs"#-}
+                    {-# LINE 3610 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule366 #-}
    {-# LINE 138 "src-ag/LOAG/Order.ag" #-}
    rule366 = \ ((_lhsIvisitnum) :: Int) ->
                         {-# LINE 138 "src-ag/LOAG/Order.ag" #-}
                         _lhsIvisitnum
-                        {-# LINE 3615 "dist/build/LOAG/Order.hs"#-}
+                        {-# LINE 3616 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule367 #-}
    {-# LINE 139 "src-ag/LOAG/Order.ag" #-}
    rule367 = \ _initial _segments ->
                         {-# LINE 139 "src-ag/LOAG/Order.ag" #-}
                         zipWith const [_initial    ..] _segments
-                        {-# LINE 3621 "dist/build/LOAG/Order.hs"#-}
+                        {-# LINE 3622 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule368 #-}
    {-# LINE 140 "src-ag/LOAG/Order.ag" #-}
    rule368 = \ _vnums ->
                              {-# LINE 140 "src-ag/LOAG/Order.ag" #-}
                              _vnums
-                             {-# LINE 3627 "dist/build/LOAG/Order.hs"#-}
+                             {-# LINE 3628 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule369 #-}
    {-# LINE 141 "src-ag/LOAG/Order.ag" #-}
    rule369 = \ _initial _vnums ->
                         {-# LINE 141 "src-ag/LOAG/Order.ag" #-}
                         Map.fromList $ (_initial     + length _vnums, NoneVis)
                                      : [(v, OneVis v) | v <- _vnums ]
-                        {-# LINE 3634 "dist/build/LOAG/Order.hs"#-}
+                        {-# LINE 3635 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule370 #-}
    {-# LINE 143 "src-ag/LOAG/Order.ag" #-}
    rule370 = \ _initial _vnums ->
                         {-# LINE 143 "src-ag/LOAG/Order.ag" #-}
                         Map.fromList $ (_initial    , NoneVis)
                                      : [(v+1, OneVis v) | v <- _vnums ]
-                        {-# LINE 3641 "dist/build/LOAG/Order.hs"#-}
+                        {-# LINE 3642 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule371 #-}
    {-# LINE 145 "src-ag/LOAG/Order.ag" #-}
    rule371 = \ _initial _mysegments ->
@@ -3645,7 +3646,7 @@
                         let op vnr (MySegment visnr ins syns _ _) =
                               IMap.fromList $ zip syns (repeat vnr)
                          in IMap.unions $ zipWith op [_initial    ..] _mysegments
-                        {-# LINE 3649 "dist/build/LOAG/Order.hs"#-}
+                        {-# LINE 3650 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule372 #-}
    {-# LINE 148 "src-ag/LOAG/Order.ag" #-}
    rule372 = \ _classContexts _hoInfo _initial _initialVisit _nextVis _prevVis ((_prodsIeprods) :: EProductions) _recursive nt_ params_ ->
@@ -3661,14 +3662,14 @@
                           _prodsIeprods
                           _recursive
                           _hoInfo     ]
-                       {-# LINE 3665 "dist/build/LOAG/Order.hs"#-}
+                       {-# LINE 3666 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule373 #-}
    {-# LINE 322 "src-ag/LOAG/Order.ag" #-}
    rule373 = \ ((_lhsIsched) :: InterfaceRes) nt_ ->
                          {-# LINE 322 "src-ag/LOAG/Order.ag" #-}
                          findWithErr _lhsIsched "could not const. interfaces"
                               (getName nt_)
-                         {-# LINE 3672 "dist/build/LOAG/Order.hs"#-}
+                         {-# LINE 3673 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule374 #-}
    {-# LINE 324 "src-ag/LOAG/Order.ag" #-}
    rule374 = \ _assigned ((_lhsIsched) :: InterfaceRes) ->
@@ -3677,7 +3678,7 @@
                           then 0
                           else let mx = fst $ IMap.findMax _assigned     in
                                 if even mx then mx else mx + 1
-                         {-# LINE 3681 "dist/build/LOAG/Order.hs"#-}
+                         {-# LINE 3682 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule375 #-}
    {-# LINE 329 "src-ag/LOAG/Order.ag" #-}
    rule375 = \ _assigned _mx ->
@@ -3687,7 +3688,7 @@
                           (maybe [] id $ IMap.lookup (i-1) _assigned    )
                               Nothing Nothing)
                    [_mx    ,_mx    -2 .. 2]
-              {-# LINE 3691 "dist/build/LOAG/Order.hs"#-}
+              {-# LINE 3692 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule376 #-}
    {-# LINE 335 "src-ag/LOAG/Order.ag" #-}
    rule376 = \ ((_lhsInmp) :: NMP) _mysegments ->
@@ -3696,7 +3697,7 @@
                       CSegment (Map.unions $ map (vertexToAttr _lhsInmp) is)
                                (Map.unions $ map (vertexToAttr _lhsInmp) ss))
                   _mysegments
-              {-# LINE 3700 "dist/build/LOAG/Order.hs"#-}
+              {-# LINE 3701 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule377 #-}
    rule377 = \ ((_prodsIads) :: [Edge]) ->
      _prodsIads
@@ -4556,7 +4557,7 @@
                 let isLocal = (field_ == _LOC || field_ == _INST)
                  in [(getName field_, (getName attr_, dlhs field_),
                       isLocal)] ++ _patIafs
-                {-# LINE 4560 "dist/build/LOAG/Order.hs"#-}
+                {-# LINE 4561 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule552 #-}
    rule552 = \ ((_patIcopy) :: Pattern) attr_ field_ ->
      Alias field_ attr_ _patIcopy
@@ -4891,31 +4892,31 @@
    rule576 = \ ((_lhsIaroundMap) :: Map ConstructorIdent (Map Identifier [Expression])) con_ ->
                                                  {-# LINE 89 "src-ag/ExecutionPlanCommon.ag" #-}
                                                  Map.findWithDefault Map.empty con_ _lhsIaroundMap
-                                                 {-# LINE 4895 "dist/build/LOAG/Order.hs"#-}
+                                                 {-# LINE 4896 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule577 #-}
    {-# LINE 114 "src-ag/ExecutionPlanCommon.ag" #-}
    rule577 = \ ((_lhsImergeMap) :: Map ConstructorIdent (Map Identifier (Identifier, [Identifier], Expression))) con_ ->
                                                 {-# LINE 114 "src-ag/ExecutionPlanCommon.ag" #-}
                                                 Map.findWithDefault Map.empty con_ _lhsImergeMap
-                                                {-# LINE 4901 "dist/build/LOAG/Order.hs"#-}
+                                                {-# LINE 4902 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule578 #-}
    {-# LINE 120 "src-ag/ExecutionPlanCommon.ag" #-}
    rule578 = \ _mergeMap ->
                          {-# LINE 120 "src-ag/ExecutionPlanCommon.ag" #-}
                          Set.unions [ Set.fromList ms | (_,ms,_) <- Map.elems _mergeMap     ]
-                         {-# LINE 4907 "dist/build/LOAG/Order.hs"#-}
+                         {-# LINE 4908 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule579 #-}
    {-# LINE 160 "src-ag/ExecutionPlanCommon.ag" #-}
    rule579 = \ ((_typeSigsIlocalSigMap) :: Map Identifier Type) con_ ->
                                                    {-# LINE 160 "src-ag/ExecutionPlanCommon.ag" #-}
                                                    Map.singleton con_ _typeSigsIlocalSigMap
-                                                   {-# LINE 4913 "dist/build/LOAG/Order.hs"#-}
+                                                   {-# LINE 4914 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule580 #-}
    {-# LINE 115 "src-ag/LOAG/Prepare.ag" #-}
    rule580 = \ ((_lhsIdty) :: MyType) con_ ->
                {-# LINE 115 "src-ag/LOAG/Prepare.ag" #-}
                (_lhsIdty,getName con_)
-               {-# LINE 4919 "dist/build/LOAG/Order.hs"#-}
+               {-# LINE 4920 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule581 #-}
    {-# LINE 117 "src-ag/LOAG/Prepare.ag" #-}
    rule581 = \ ((_childrenIpmpr) :: PMP_R) ((_lhsIaugM) :: Map.Map Identifier (Set.Set Dependency)) _pll con_ ->
@@ -4923,37 +4924,37 @@
           case Map.lookup con_ _lhsIaugM of
            Nothing -> []
            Just a  -> Set.toList $ Set.map (depToEdge _childrenIpmpr _pll    ) a
-          {-# LINE 4927 "dist/build/LOAG/Order.hs"#-}
+          {-# LINE 4928 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule582 #-}
    {-# LINE 120 "src-ag/LOAG/Prepare.ag" #-}
    rule582 = \ ((_lhsIdty) :: MyType) ->
                      {-# LINE 120 "src-ag/LOAG/Prepare.ag" #-}
                      _lhsIdty
-                     {-# LINE 4933 "dist/build/LOAG/Order.hs"#-}
+                     {-# LINE 4934 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule583 #-}
    {-# LINE 214 "src-ag/LOAG/Prepare.ag" #-}
    rule583 = \ ((_lhsIdty) :: MyType) con_ ->
                   {-# LINE 214 "src-ag/LOAG/Prepare.ag" #-}
                   (_lhsIdty,getName con_)
-                  {-# LINE 4939 "dist/build/LOAG/Order.hs"#-}
+                  {-# LINE 4940 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule584 #-}
    {-# LINE 215 "src-ag/LOAG/Prepare.ag" #-}
    rule584 = \ _pll ->
                   {-# LINE 215 "src-ag/LOAG/Prepare.ag" #-}
                   _pll
-                  {-# LINE 4945 "dist/build/LOAG/Order.hs"#-}
+                  {-# LINE 4946 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule585 #-}
    {-# LINE 216 "src-ag/LOAG/Prepare.ag" #-}
    rule585 = \ ((_childrenIpts) :: Set.Set FLabel) ->
                   {-# LINE 216 "src-ag/LOAG/Prepare.ag" #-}
                   _childrenIpts
-                  {-# LINE 4951 "dist/build/LOAG/Order.hs"#-}
+                  {-# LINE 4952 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule586 #-}
    {-# LINE 217 "src-ag/LOAG/Prepare.ag" #-}
    rule586 = \ ((_childrenIfieldMap) :: FMap) _pll ->
                   {-# LINE 217 "src-ag/LOAG/Prepare.ag" #-}
                   Map.singleton _pll $ Map.keys _childrenIfieldMap
-                  {-# LINE 4957 "dist/build/LOAG/Order.hs"#-}
+                  {-# LINE 4958 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule587 #-}
    {-# LINE 89 "src-ag/LOAG/Order.ag" #-}
    rule587 = \ ((_lhsIdty) :: MyType) ((_lhsIpmpf) :: PMP) ((_lhsIres_ads) :: [Edge]) con_ ->
@@ -4964,19 +4965,19 @@
               | otherwise
                   = ds
         in Map.singleton con_ $ foldr op Set.empty _lhsIres_ads
-        {-# LINE 4968 "dist/build/LOAG/Order.hs"#-}
+        {-# LINE 4969 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule588 #-}
    {-# LINE 167 "src-ag/LOAG/Order.ag" #-}
    rule588 = \ ((_rulesIruleMap) :: Map.Map MyOccurrence Identifier) ->
                           {-# LINE 167 "src-ag/LOAG/Order.ag" #-}
                           _rulesIruleMap
-                          {-# LINE 4974 "dist/build/LOAG/Order.hs"#-}
+                          {-# LINE 4975 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule589 #-}
    {-# LINE 168 "src-ag/LOAG/Order.ag" #-}
    rule589 = \  (_ :: ()) ->
                           {-# LINE 168 "src-ag/LOAG/Order.ag" #-}
                           (Set.empty, Set.empty, Set.empty, Set.empty)
-                          {-# LINE 4980 "dist/build/LOAG/Order.hs"#-}
+                          {-# LINE 4981 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule590 #-}
    {-# LINE 169 "src-ag/LOAG/Order.ag" #-}
    rule590 = \ ((_childrenIself) :: Children) ->
@@ -4985,7 +4986,7 @@
                               | kind == ChildAttr = Nothing
                               | otherwise = Just $ ChildIntro nm
                           in catMaybes $ map intro _childrenIself
-                        {-# LINE 4989 "dist/build/LOAG/Order.hs"#-}
+                        {-# LINE 4990 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule591 #-}
    {-# LINE 174 "src-ag/LOAG/Order.ag" #-}
    rule591 = \ ((_childrenIechilds) :: EChildren) _intros ((_rulesIerules) :: ERules) ((_segsIevisits) :: Visits) con_ constraints_ params_ ->
@@ -5002,7 +5003,7 @@
                           _rulesIerules
                           _childrenIechilds
                           visits ]
-              {-# LINE 5006 "dist/build/LOAG/Order.hs"#-}
+              {-# LINE 5007 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule592 #-}
    {-# LINE 346 "src-ag/LOAG/Order.ag" #-}
    rule592 = \ ((_lhsImysegments) :: MySegments) ((_lhsInmp) :: NMP) ((_lhsIpmprf) :: PMP_R) _ps ->
@@ -5016,7 +5017,7 @@
                                       handAllOut (_ps    ,"lhs") $
                                           map (_lhsInmp Map.!) syns)
                            ) _lhsImysegments
-              {-# LINE 5020 "dist/build/LOAG/Order.hs"#-}
+              {-# LINE 5021 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule593 #-}
    rule593 = \ ((_childrenIap) :: A_P) ->
      _childrenIap
@@ -5336,13 +5337,13 @@
    rule649 = \ ((_lhsIvisitnum) :: Int) ->
                           {-# LINE 192 "src-ag/LOAG/Order.ag" #-}
                           _lhsIvisitnum
-                          {-# LINE 5340 "dist/build/LOAG/Order.hs"#-}
+                          {-# LINE 5341 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule650 #-}
    {-# LINE 193 "src-ag/LOAG/Order.ag" #-}
    rule650 = \ ((_hdIvisitnum) :: Int) ->
                           {-# LINE 193 "src-ag/LOAG/Order.ag" #-}
                           _hdIvisitnum
-                          {-# LINE 5346 "dist/build/LOAG/Order.hs"#-}
+                          {-# LINE 5347 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule651 #-}
    rule651 = \ ((_hdIads) :: [Edge]) ((_tlIads) :: [Edge]) ->
      ((++) _hdIads _tlIads)
@@ -5784,31 +5785,31 @@
                               explicit_
                               pure_
                               mbError_
-                        {-# LINE 5788 "dist/build/LOAG/Order.hs"#-}
+                        {-# LINE 5789 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule752 #-}
    {-# LINE 12 "src-ag/ExecutionPlanPre.ag" #-}
    rule752 = \ ((_lhsIrulenumber) :: Int) ->
                              {-# LINE 12 "src-ag/ExecutionPlanPre.ag" #-}
                              _lhsIrulenumber + 1
-                             {-# LINE 5794 "dist/build/LOAG/Order.hs"#-}
+                             {-# LINE 5795 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule753 #-}
    {-# LINE 13 "src-ag/ExecutionPlanPre.ag" #-}
    rule753 = \ ((_lhsIrulenumber) :: Int) mbName_ ->
                              {-# LINE 13 "src-ag/ExecutionPlanPre.ag" #-}
                              maybe (identifier $ "rule" ++ show _lhsIrulenumber) id mbName_
-                             {-# LINE 5800 "dist/build/LOAG/Order.hs"#-}
+                             {-# LINE 5801 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule754 #-}
    {-# LINE 230 "src-ag/LOAG/Prepare.ag" #-}
    rule754 = \ ((_rhsIused) :: Set.Set MyOccurrence) ->
                        {-# LINE 230 "src-ag/LOAG/Prepare.ag" #-}
                        Set.filter (\(MyOccurrence (_,f) _) -> f == "loc") _rhsIused
-                       {-# LINE 5806 "dist/build/LOAG/Order.hs"#-}
+                       {-# LINE 5807 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule755 #-}
    {-# LINE 231 "src-ag/LOAG/Prepare.ag" #-}
    rule755 = \ _usedLocals ->
                        {-# LINE 231 "src-ag/LOAG/Prepare.ag" #-}
                        not $ Set.null _usedLocals
-                       {-# LINE 5812 "dist/build/LOAG/Order.hs"#-}
+                       {-# LINE 5813 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule756 #-}
    {-# LINE 233 "src-ag/LOAG/Prepare.ag" #-}
    rule756 = \ ((_lhsIlfpf) :: SF_P) ((_lhsIpll) :: PLabel) ((_patternIafs) :: [(FLabel, ALabel, Bool)]) ((_rhsIused) :: Set.Set MyOccurrence) _rulename _usedLocals _usesLocals ->
@@ -5832,7 +5833,7 @@
                                   (Set.singleton att) m) lr _rhsIused)
                   else (sfpins,rm,l,lr))
                           (Map.empty,Map.empty,Map.empty,Map.empty) _patternIafs
-          {-# LINE 5836 "dist/build/LOAG/Order.hs"#-}
+          {-# LINE 5837 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule757 #-}
    rule757 = \ ((_rhsIused) :: Set.Set MyOccurrence) ->
      _rhsIused
@@ -6158,7 +6159,7 @@
    rule795 = \ name_ tp_ ->
                                                    {-# LINE 161 "src-ag/ExecutionPlanCommon.ag" #-}
                                                    Map.singleton name_ tp_
-                                                   {-# LINE 6162 "dist/build/LOAG/Order.hs"#-}
+                                                   {-# LINE 6163 "dist/build/LOAG/Order.hs"#-}
    {-# INLINE rule796 #-}
    rule796 = \ name_ tp_ ->
      TypeSig name_ tp_
diff --git a/src/LOAG/Chordal.hs b/src/LOAG/Chordal.hs
--- a/src/LOAG/Chordal.hs
+++ b/src/LOAG/Chordal.hs
@@ -164,7 +164,7 @@
                     ruleOut c1 c2 c3
                     return [(t1,(t2,c3))]
           [c3] -> ruleOut c1 c2 c3 >> return []
-          _   -> error "multiple edges between two nodes" 
+          _   -> error "multiple edges between two nodes"
       Nothing -> error "pointer outside of graph"
  where 
         ruleOut ea eb ab= do addClause sat [ea, ab, varnot eb]
@@ -203,7 +203,7 @@
                     ruleOut c1 c2 (Any p)
                     return [(t1,(t2,(Any p)))]
           [c3] -> ruleOut c1 c2 c3 >> return [] 
-          _   -> error "multiple edges between two nodes" 
+          _   -> error "multiple edges between two nodes"
       Nothing -> error "pointer outside of graph"
  where  ruleOut ea eb ab= addClauses sat [[ea, ab, neg eb],[neg ea,neg ab,eb]] 
 noNtCycles :: Sat -> [Nt] -> (String -> IO ()) -> IO VarMap 
@@ -218,6 +218,9 @@
             vars <- satValues sat
             putStrLn ("nt : " ++ tid ++ " ... " ++ 
                         show vars ++ " ...")
+            when (not $ S.null $ S.fromList dpf `S.intersection`
+                     S.fromList (map (\(a,b) -> (b,a)) dpt)) $
+               error "Type 2 cycle of length 2"
             ass <- sequence $
                     [ return ((i,s),VarTrue) | ((i,s)) <- dpf ]++
                     [ return ((i,s),VarFalse)| ((s,i)) <- dpt ] 
diff --git a/uuagc.cabal b/uuagc.cabal
--- a/uuagc.cabal
+++ b/uuagc.cabal
@@ -1,7 +1,7 @@
 cabal-version: >= 1.8
 build-type: Custom
 name: uuagc
-version: 0.9.52
+version: 0.9.52.1
 license: BSD3
 license-file: LICENSE
 maintainer: Jeroen Bransen <J.Bransen@uu.nl>
@@ -17,6 +17,9 @@
 extra-source-files: README
 extra-source-files: uuagc_options
 extra-source-files: src-ag/DistChildAttr.ag
+extra-source-files: src-ag/ExecutionPlanCommon.ag
+extra-source-files: src-ag/ExecutionPlanPre.ag
+extra-source-files: src-ag/LOAG/Prepare.ag
 
 -- This flag will be set by Setup.hs, use
 -- cabal configure --ghc-options="-DEXTERNAL_UUAGC"
@@ -35,7 +38,7 @@
    build-depends: uuagc-cabal >= 1.0.2.0
    build-depends: base >= 4, base < 5
    -- Self dependency, depend on library below
-   build-depends: uuagc == 0.9.52
+   build-depends: uuagc == 0.9.52.1
    main-is: Main.hs
    hs-source-dirs: src-main
 
