@@ -15,6 +15,14 @@ import Agda.TypeChecking.Substitute ( raise )
1515import Agda.Syntax.Common.Pretty
1616import Agda.Syntax.Treeless
1717
18+ import Agda.Compiler.ToTreeless qualified as TT
19+ import Agda.Compiler.Treeless.Builtin qualified as TT
20+ import Agda.Compiler.Treeless.Erase qualified as TT
21+ import Agda.Compiler.Treeless.Simplify qualified as TT
22+ import Agda.Compiler.Treeless.Identity qualified as TT
23+ import Agda.Compiler.Treeless.Uncase qualified as TT
24+ import Agda.Compiler.Treeless.AsPatterns qualified as TT
25+
1826
1927-- * Miscellaneous
2028
@@ -39,6 +47,26 @@ isFunDef = \case
3947
4048isDataOrRecDef = liftA2 (||) isDataDef isRecDef
4149
50+ -- ** toTreeless custom pipeline
51+
52+ -- | Convert compiled clauses to treeless syntax, and return it.
53+ treeless :: QName -> TCM (Maybe TTerm )
54+ treeless = TT. toTreelessWith compilerPipeline (EagerEvaluation , TT. EraseUnused )
55+ where
56+ compilerPipeline v q =
57+ TT. Sequential
58+ -- NOTE (flupe): this is the default Agda treeless pipeline
59+ -- with the builtin pass removed.
60+ -- [ TT.compilerPass "builtin" (30 + v) "builtin translation" $ const TT.translateBuiltins
61+ [ TT. FixedPoint 5 $ TT. Sequential
62+ [ TT. compilerPass " simpl" (30 + v) " simplification" $ const TT. simplifyTTerm
63+ , TT. compilerPass " erase" (30 + v) " erasure" $ TT. eraseTerms q
64+ , TT. compilerPass " uncase" (30 + v) " uncase" $ const TT. caseToSeq
65+ , TT. compilerPass " aspat" (30 + v) " @-pattern recovery" $ const TT. recoverAsPatterns
66+ ]
67+ , TT. compilerPass " id" (30 + v) " identity function detection" $ const (TT. detectIdentityFunctions q)
68+ ]
69+
4270-- ** eta-expansion of constructors
4371
4472-- NOTE(flupe):
0 commit comments