-
Notifications
You must be signed in to change notification settings - Fork 378
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
90 additions
and
3 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,16 @@ | ||
module NoEscape | ||
|
||
import Language.Reflection | ||
|
||
%language ElabReflection | ||
|
||
0 n : Nat | ||
n = 3 | ||
|
||
0 elabScript : Elab Nat | ||
elabScript = pure n | ||
|
||
failing "n is not accessible in this context" | ||
|
||
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,35 @@ | ||
||| 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) | ||
|
||
failing "x is not accessible in this context" | ||
|
||
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'} | ||
|
||
failing "x is not accessible in this context" | ||
|
||
%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,3 @@ | ||
1/1: Building RunElab0 (RunElab0.idr) | ||
1/1: Building NoEscape (NoEscape.idr) | ||
1/1: Building NoEscapePar (NoEscapePar.idr) |
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 |