Patrick Bahr avatar Patrick Bahr committed 37979bc

added composition operator for MTTLs followed by DTTs

Comments (0)

Files changed (1)


     , MacroTransLA'
     , mkMacroTransLA
     , runMacroTransLA
+    , compDownMacroLA
     -- * Macro Tree Transducers with Regular Look-Ahead
     , (:^:) (..)
     , I (..)
     run' :: Term f -> (q (Context g (Term g)) -> (Term g), p)
     run' t = let (res, p) = run t
              in  (res . fmap appCxt, p)
+-- | This function composes an MTT with regular look-ahead followed by
+-- a DTT.
+compDownMacroLA :: forall f g h q1 q2 p . (Functor f, Functor g, Functor h, Functor q1) =>
+                 DownTrans g q2 h -> MacroTransLA f q1 p g -> MacroTransLA f (q1 :^: q2) p h
+compDownMacroLA t2 t1 (q1 :^: q2) p t = runDownTrans' t2 q2 (t1 (fmap (\a q2' -> a q2') q1) p (fmap reshape t))
+    where reshape :: ((q1 :^: q2) (Context h a) -> a,p) -> (q1 (Context g (q2 -> a)) -> q2 -> a,p)
+          reshape (f,p) = (\q1' q2' -> f (fmap (\s q2'' -> runDownTrans' t2 q2'' s) q1' :^: q2'),p)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.