You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Repair Agda's REPL (agda -I) to work with --safe flag #4649
REPLInteractive toplevelallow-unsolved-metasIssues relating to allow-unsolved-metashelp wantedsafeSubset of Agda features which is expected to be consistenttype: enhancementIssues and pull requests about possible improvements
Especially for teaching it would be nice if agda had a top-level REPL (read-eval-print loop) so that one can evaluate expressions interactively without always having to go via C-c C-n. Also I would like to print streams using costrings.
Has this been discussed before? What would be the effort and possible issues?
Reacted by herminie, Reed Mullanix, Tesla Zhang, Musa Al-hassy and jg
Agda already has a REPL, but it is unmaintained. Try agda -I. Currently it does not work very well with code that uses --safe, but I guess that could be fixed.
Also I would like to print streams using costrings.
I'm not sure exactly what you mean. Can't you use the following function from the standard library?
Ok, first of all as you already indicated there seem to be some issues with agda -I. Just trying to load Data.Nat doesn't seem to work:
txa@sean agda-src % agda -I test.agda
The interactive mode is no longer under active development. Use at your own risk.
Checking test (/Users/txa/agda-src/test.agda).
Checking Data.Nat (/Users/txa/agda/std-lib/src/Data/Nat.agda).
Checking Data.Nat.Base (/Users/txa/agda/std-lib/src/Data/Nat/Base.agda).
Checking Level (/Users/txa/agda/std-lib/src/Level.agda).
/Users/txa/agda/std-lib/src/Data/Nat/Base.agda:14,1-29
Cannot set OPTIONS pragma --allow-unsolved-metas with safe flag.
when scope checking the declaration
open import Level using (0ℓ)
Also I would like to be able to open a REPL in a separate buffer after loading the current buffer via an emacs command.
I don't think Agda should accept code with holes when --safe is used. Perhaps it is fine to leave it as it is for now, because we do advertise that agda -I is not supported. However, there seems to be interest in actually supporting agda -I, so I don't think we should close this issue.
Does anyone know why --allow-unsolved-metas is turned on? Apparently it has been like this since 2006 (ff2ccf6), but back then this setting was used also for the Emacs mode. I suggest that we turn off --allow-unsolved-metas. Perhaps something breaks, but I would assume that it breaks in a "safe" way: fewer programs are accepted, not more.
I wouldn't say that agda -I needs to speak with authority on what is safe and what not. It is a REPL to tinker around and evaluate stuff.
Does anyone know why --allow-unsolved-metas is turned on?
I suppose to enable to interactively give solutions to metas.
However, there seems to be interest in actually supporting agda -I, so I don't think we should close this issue.
Users can always open issues when they seek functionality or find bugs. The OP here was fixed, thus, I do not see a reason why to keep this issue in limbo.
This code has been unmaintained for a long time. I guess that it was not updated when the Emacs mode was changed.
One practical consequence of using --allow-unsolved-metas that has not been mentioned above is that in many cases Agda decides that the options have changed and decides to typecheck everything from scratch.
A never mind, I got confused by the error message (that seems to be ignored): agda -I does complain about --safe --unsolved-metas but still lets me work with open metas.
REPLInteractive toplevelallow-unsolved-metasIssues relating to allow-unsolved-metashelp wantedsafeSubset of Agda features which is expected to be consistenttype: enhancementIssues and pull requests about possible improvements
Activity
nad commentedon May 13, 2020
Agda already has a REPL, but it is unmaintained. Try
agda -I. Currently it does not work very well with code that uses--safe, but I guess that could be fixed.I'm not sure exactly what you mean. Can't you use the following function from the standard library?
pnlph commentedon May 13, 2020
To add some information, there is a recent comparison among several programming languages with REPLs and typed holes put up together by @ice1000
txa commentedon May 13, 2020
Ok, first of all as you already indicated there seem to be some issues with agda -I. Just trying to load Data.Nat doesn't seem to work:
Also I would like to be able to open a REPL in a separate buffer after loading the current buffer via an emacs command.
nad commentedon May 13, 2020
If you want to play around with the REPL right now you can comment out two lines:
agda/src/full/Agda/Interaction/Options.hs
Line 770 in a9d6c1d
agda/src/full/Agda/Interaction/Options.hs
Line 772 in a9d6c1d
However, I guess that this may break some part of the REPL.
[-]REPL for agda (feature request)[/-][+]Repair Agda's REPL (agda -I) to work with --safe flag[/+]andreasabel commentedon May 16, 2020
Fixing this by allowing
--safeand--allow-unsolved-metasto coexist in-Imode.[ fixed agda#4649 ] allow --allow-unsolved-metas with --safe in -I mode
nad commentedon May 26, 2020
Now
--allow-unsolved-metasis turned on also in imported modules. Test case:Is this intended?
4 remaining items
nad commentedon May 27, 2020
I don't think Agda should accept code with holes when
--safeis used. Perhaps it is fine to leave it as it is for now, because we do advertise thatagda -Iis not supported. However, there seems to be interest in actually supportingagda -I, so I don't think we should close this issue.Does anyone know why
--allow-unsolved-metasis turned on? Apparently it has been like this since 2006 (ff2ccf6), but back then this setting was used also for the Emacs mode. I suggest that we turn off--allow-unsolved-metas. Perhaps something breaks, but I would assume that it breaks in a "safe" way: fewer programs are accepted, not more.andreasabel commentedon May 27, 2020
I wouldn't say that
agda -Ineeds to speak with authority on what is safe and what not. It is a REPL to tinker around and evaluate stuff.I suppose to enable to interactively give solutions to metas.
Users can always open issues when they seek functionality or find bugs. The OP here was fixed, thus, I do not see a reason why to keep this issue in limbo.
nad commentedon May 27, 2020
I don't think we should ignore issues related to
--safe.If there are no objections I can revert your change and turn off
--allow-unsolved-metas.ice1000 commentedon May 28, 2020
I would ask why does the REPL forcibly requires
--allow-unsolved-metas. We can work with--safefiles with unsolved metas in Emacs, right?nad commentedon May 28, 2020
This code has been unmaintained for a long time. I guess that it was not updated when the Emacs mode was changed.
One practical consequence of using
--allow-unsolved-metasthat has not been mentioned above is that in many cases Agda decides that the options have changed and decides to typecheck everything from scratch.[ re #4649 ] Accidentally disabled `agda -I` completely, repair it again
andreasabel commentedon Nov 9, 2024
This issue has been closed as fixed but the OP persists:
andreasabel commentedon Nov 9, 2024
A never mind, I got confused by the error message (that seems to be ignored):
agda -Idoes complain about--safe --unsolved-metasbut still lets me work with open metas.