-
Notifications
You must be signed in to change notification settings - Fork 379
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ elab ] Make
%runElab
expressions to have unrestricted quantity
- Loading branch information
Showing
10 changed files
with
113 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module NoEscape | ||
|
||
import Language.Reflection | ||
|
||
%language ElabReflection | ||
|
||
0 n : Nat | ||
n = 3 | ||
|
||
0 elabScript : Elab Nat | ||
elabScript = pure n | ||
|
||
m : Nat | ||
m = %runElab elabScript |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
||| Check that we cannot implement function illegally escaping zero quantity using elaboration reflection | ||
module NoEscapePar | ||
|
||
import Language.Reflection | ||
|
||
%language ElabReflection | ||
|
||
escScr : Elab $ (0 _ : a) -> a | ||
escScr = check $ ILam EmptyFC M0 ExplicitArg (Just `{x}) `(a) `(x) | ||
|
||
esc : (0 _ : a) -> a | ||
esc = %runElab escScr | ||
|
||
escd : (0 _ : a) -> a | ||
|
||
0 escd' : (0 _ : a) -> a | ||
|
||
escDecl : Name -> Elab Unit | ||
escDecl name = declare [ | ||
IDef EmptyFC name [ | ||
PatClause EmptyFC | ||
-- lhs | ||
(IApp EmptyFC (IVar EmptyFC name) (IBindVar EmptyFC "x")) | ||
-- rhs | ||
`(x) | ||
] | ||
] | ||
|
||
%runElab escDecl `{escd'} | ||
|
||
%runElab escDecl `{escd} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module RunElab0 | ||
|
||
import Language.Reflection | ||
|
||
%language ElabReflection | ||
|
||
0 elabScript : Elab Unit | ||
elabScript = pure () | ||
|
||
x : Unit | ||
x = %runElab elabScript | ||
|
||
%runElab elabScript |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
1/1: Building RunElab0 (RunElab0.idr) | ||
1/1: Building NoEscape (NoEscape.idr) | ||
Error: While processing right hand side of m. NoEscape.n is not accessible in this context. | ||
|
||
NoEscape:11:19--11:20 | ||
07 | 0 n : Nat | ||
08 | n = 3 | ||
09 | | ||
10 | 0 elabScript : Elab Nat | ||
11 | elabScript = pure n | ||
^ | ||
|
||
1/1: Building NoEscapePar (NoEscapePar.idr) | ||
Error: While processing right hand side of esc. x is not accessible in this context. | ||
|
||
NoEscape:9:65--9:66 | ||
5 | | ||
6 | %language ElabReflection | ||
7 | | ||
8 | escScr : Elab $ (0 _ : a) -> a | ||
9 | escScr = check $ ILam EmptyFC M0 ExplicitArg (Just `{x}) `(a) `(x) | ||
^ | ||
|
||
Error: While processing right hand side of escd. x is not accessible in this context. | ||
|
||
NoEscape:25:24--25:25 | ||
21 | PatClause EmptyFC | ||
22 | -- lhs | ||
23 | (IApp EmptyFC (IVar EmptyFC name) (IBindVar EmptyFC "x")) | ||
24 | -- rhs | ||
25 | `(x) | ||
^ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
rm -rf build | ||
|
||
$1 --no-color --console-width 0 --check RunElab0.idr | ||
$1 --no-color --console-width 0 --check NoEscape.idr | ||
$1 --no-color --console-width 0 --check NoEscapePar.idr |