<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body lang="EN-GB" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">This is really bad from a paedagogical perspective if you use agda for teaching!<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Is there nobody who could implement a read-eval-print loop for agda? It shouldn’t be that difficult?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Cheers,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Thorsten<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span style="font-size:12.0pt;color:black">From: </span></b><span style="font-size:12.0pt;color:black">Agda <agda-bounces@lists.chalmers.se> on behalf of Jesper Cockx <Jesper@sikanda.be><br>
<b>Date: </b>Tuesday, 1 February 2022 at 20:01<br>
<b>To: </b>Eduardo Ochs <eduardoochs@gmail.com><br>
<b>Cc: </b>agda list <agda@lists.chalmers.se><br>
<b>Subject: </b>Re: [Agda] Quirk: C-c C-n thinks that some symbols are not in scope<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">Hi Eduardo,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">C-c c-n evaluates the given expression in the scope of the current module as it looks like from the outside (i.e. as if you import the module somewhere else). In particular, this scope does not include symbols from modules you have opened,
unless they have been opened publicly. So I expect you can solve your problem by adding 'public' to the end of your open statements, e.g. 'open Add "2" public'.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">-- Jesper<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On Tue, Feb 1, 2022 at 8:12 PM Eduardo Ochs <<a href="mailto:eduardoochs@gmail.com">eduardoochs@gmail.com</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<div>
<p class="MsoNormal">Hello list,<br>
<br>
I think that I found a quirk on the behavior of `C-c C-n'. When I was<br>
trying to write a minimal example that showed the problem I wrote<br>
this, that isn't really minimal but that should be minimal enough...<br>
<br>
module NameOfThisFile where<br>
<br>
open import Agda.Builtin.String<br>
open import Agda.Builtin.String.Properties<br>
<br>
infixl 4 _++_<br>
_++_ : String -> String -> String<br>
_++_ str1 str2 = primStringAppend str1 str2<br>
<br>
module Add (i : String) where<br>
infixl 4 _+++_<br>
add : String -> String -> String<br>
add a b = "(" ++ a ++ " +_" ++ i ++ " " ++ b ++ ")"<br>
_+++_ : String -> String -> String<br>
_+++_ a b = add a b<br>
<br>
module Add0 = Add "0"<br>
module Add1 = Add "1"<br>
-- open Add0<br>
open Add "2"<br>
<br>
aa : String<br>
aa = "AAA"<br>
bb : String<br>
bb = "BBB"<br>
cc : String<br>
cc = aa +++ bb<br>
<br>
-- (find-agdanorm "aa ++ bb")<br>
-- (find-agdanorm "Add.add \"4\" aa bb")<br>
-- (find-agdanorm "Add0.add aa bb")<br>
-- (find-agdanorm "Add._+++_ \"9\" aa bb")<br>
-- (find-agdanorm "Add0._+++_ aa bb")<br>
-- (find-agdanorm "aa Add0.+++ bb")<br>
-- (find-agdanorm "aa +++ bb")<br>
-- (find-agdanorm "_+++_")<br>
-- (find-agdatype "_+++_")<br>
-- (find-agdanorm "cc")<br>
<br>
The sexps like (find-agdanorm "<expr>") in comments use a hack that I<br>
wrote that is simple to explain. The docstring of find-agdanorm is:<br>
<br>
(find-agdanorm AGDAEXPR &rest REST)<br>
<br>
Show the normalized value of AGDAEXPR in the buffer "*Normal Form*".<br>
This function goes to the beginning of the Agda comment in the<br>
current line, i.e., to the first occurrence of "--" in the<br>
current line, and the runs ‘C-c C-n AGDAEXPR RET’ there.<br>
This only works in agda2-mode. This is a quick hack!<br>
<br>
If I go to the beginning of the line with the<br>
<br>
-- (find-agdanorm "aa +++ bb")<br>
<br>
and I type `C-c C-n aa +++ bb RET' there - or if I execute the sexp -<br>
Agda tells me that the _+++_ is not in scope, and the same happens<br>
with this one here:<br>
<br>
-- (find-agdanorm "_+++_")<br>
<br>
I get the same "Not in scope" if I use `C-c C-d _+++_' to get the type<br>
of _+++_... but the last sexp,<br>
<br>
-- (find-agdanorm "cc")<br>
<br>
works, and it shows that the normalized value of cc is this:<br>
<br>
"(AAA +_2 BBB)"<br>
<br>
All the other sexps work as expected without errors.<br>
<br>
Is that behavior documented? It seems that `C-c C-n' and `C-c C-d' are<br>
ignoring some symbols that were brought into scope by this line,<br>
<br>
open Add "2"<br>
<br>
and for me this is unexpected & bad.<br>
<br>
I am using Agda 2.6.1.3 - I don't have the current version here.<br>
I've put more info, links, and a screenshot in this page:<br>
<br>
<a href="http://angg.twu.net/eev-agda.html" target="_blank">http://angg.twu.net/eev-agda.html</a><br>
<br>
Thanks in advance!<br>
Eduardo Ochs<br>
<a href="http://angg.twu.net/#eev" target="_blank">http://angg.twu.net/#eev</a><o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
<p class="MsoNormal">_______________________________________________<br>
Agda mailing list<br>
<a href="mailto:Agda@lists.chalmers.se" target="_blank">Agda@lists.chalmers.se</a><br>
<a href="https://lists.chalmers.se/mailman/listinfo/agda" target="_blank">https://lists.chalmers.se/mailman/listinfo/agda</a><o:p></o:p></p>
</blockquote>
</div>
</div>
<PRE>
This message and any attachment are intended solely for the addressee
and may contain confidential information. If you have received this
message in error, please contact the sender and delete the email and
attachment.
Any views or opinions expressed by the author of this email do not
necessarily reflect the views of the University of Nottingham. Email
communications with the University of Nottingham may be monitored
where permitted by law.
</PRE></body>
</html>