Skip to content

Commit d0300fa

Browse files
committed
use dev version of agda for treeless pipeline
1 parent 3172836 commit d0300fa

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

agda2lambox.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ executable agda2lambox
2828
Paths_agda2lambox
2929
autogen-modules: Paths_agda2lambox
3030
build-depends: base >= 4.10 && < 4.22,
31-
Agda >= 2.7 && <= 2.8,
31+
Agda >= 2.7 && <= 2.9,
3232
deepseq >= 1.4.4 && < 1.6,
3333
queues >= 1.0.0 && < 1.2,
3434
pretty-show,

cabal.project

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
packages: .
2+
3+
source-repository-package
4+
type: git
5+
location: https://github.com/agda/agda
6+
tag: 5c29109f8212ef61b0091d62ef9c8bfdfa16cf36

src/Agda/Utils.hs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ import Agda.TypeChecking.Substitute ( raise )
1515
import Agda.Syntax.Common.Pretty
1616
import 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

4048
isDataOrRecDef = 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

Comments
 (0)