Re: Failing to get FXP to work in mlton

Matthew Fluet <[email protected]> Tue, 30 Oct 2018 21:14:18 -0400
Newsgroups gmane.comp.lang.ml.mlton.user
Message-ID <CAMrhFL7vJka8yBE_2d6m6_pM_mdrCuRsZbue-xkhet0DgWLj+w@mail.gmail.com>
--===============4482688327915185087==
Content-Type: multipart/alternative; boundary="0000000000002a9d9005797c0676"

--0000000000002a9d9005797c0676
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Michael,

The type error in your breaking repo is due to the fact that both
"src/Parser/parser.mlb" and "src/Unicode/Encode/encode.mlb" reference
"src/Unicode/encoding.sml".  There is significant difference between
referring to a .sml file and to a .mlb file within a .mlb file.  From
http://mlton.org/MLBasisSyntaxAndSemantics: "A reference to an SML source
file causes the file to be elaborated in the basis extant at the point of
reference. A reference to an MLB file causes the basis denoted by that MLB
file to be imported =E2=80=94 the basis at the point of reference does not =
affect
the imported basis. ... An MLB file is elaborated starting in an empty
basis. Each MLB file is elaborated and evaluated only once, with the result
being cached. Subsequent references use the cached value. Thus, any
observable effects due to evaluation are not duplicated if the MLB file is
referred to multiple times."  In contrast, an SML source file that is
referred to multiple times (whether within the same MLB file or different
MLB files) will be elaborated and evaluated multiple times.  That's what's
happening with "src/Unicode/encoding.sml".  Even though it has a
transparent signature match, its "datatype" declaration is generative, so
the "Encoding.Encoding" type in "parser.mlb" is different from the
"Encoding.Encoding" type in "encode.mlb".  To fix the error, you would want
to introduce a "src/Unicode/encoding.mlb" file that contains the only
reference to "src/Unicode/encoding.sml" and change the other references to
"src/Unicode/encoding.sml" in other .mlb files to references to
"src/Unicode/encoding.mlb".

-Matthew

On Tue, Oct 30, 2018 at 7:22 AM <[email protected]> wrote:

> Ha, it=E2=80=99s possible you saw my fork of Chris=E2=80=99s repo rather =
than my original
> (I just dumped what wasn=E2=80=99t working and switched to his in the sam=
e place).
> I=E2=80=99ve put the breaking repo at
>
>
>
>   https://github.com/mn200/fxp145
>
>
>
> if you=E2=80=99re interested.
>
>
>
> I was disturbed by the fact that the =E2=80=9Csame=E2=80=9D sequence of f=
iles fed to
> Poly/ML didn=E2=80=99t lead to any complaints.
>
>
>
> Best,
>
> Michael
>
>
>
> *From: *Matthew Fluet <[email protected]>
> *Reply-To: *"[email protected]" <[email protected]>
> *Date: *Tuesday, 30 October 2018 at 21:31
> *To: *MLton users <[email protected]>
> *Cc: *"[email protected]" <[email protected]=
t
> >
> *Subject: *Re: [MLton-user] Failing to get FXP to work in mlton
>
>
>
> Michael,
>
> I couldn't recreate your type error with your fxp repo.  Compiling
> `src/Apps/Copy/copy.mlb` succeeded without error.  That said, the error
> that you quoted looks like a missing `sharing` or `where` constraint.
>
> -Matthew
>
>
>
> On Tue, Oct 30, 2018 at 5:45 AM Chris Cannam <[email protected]=
m>
> wrote:
>
>
>
> On Mon, 29 Oct 2018, at 22:58, [email protected] wrote:
> > That's great, thanks!  You have a better version of the underlying code
> > too (2.0 vs 1.4.5).
> >
> > As for my compilation error, I tried to create one .mlb file per
> > directory (more or less), whereas I see you put every core .sml file
> > into the one fxplib.mlb file.
>
> Although I made a few fixes locally, most of the changes are from Timothy
> Bourke's patches at http://www.tbrk.org/software/sml-fxp.html - I just
> couldn't find an existing repo that tracked them. (Although I did say thi=
s
> in the commit log, I should probably also update the README to mention
> it... and also to update the build instructions.)
>
>
> Chris
>
>
> _______________________________________________
> MLton-user mailing list
> [email protected]; [email protected]
> https://lists.sourceforge.net/lists/listinfo/mlton-user
>
> --
> You received this message because you are subscribed to the Google Groups
> "MLton-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> _______________________________________________
> MLton-user mailing list
> [email protected]; [email protected]
> https://lists.sourceforge.net/lists/listinfo/mlton-user
>

--=20
You received this message because you are subscribed to the Google Groups "=
MLton-user" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to [email protected].

--0000000000002a9d9005797c0676
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div class=3D"gmail_defa=
ult" style=3D"font-family:&quot;courier new&quot;,monospace;font-size:large=
">Michael,</div><div class=3D"gmail_default"><span style=3D"font-family:&qu=
ot;courier new&quot;,monospace;font-size:large"><br></span></div><div class=
=3D"gmail_default"><span style=3D"font-family:&quot;courier new&quot;,monos=
pace;font-size:large">The type error in your breaking repo is due to the fa=
ct that both &quot;src/Parser/parser.mlb&quot; and &quot;src/Unicode/Encode=
/encode.mlb&quot; reference &quot;src/Unicode/encoding.sml&quot;.=C2=A0 The=
re is significant difference between referring to a .sml file and to a .mlb=
 file within a .mlb file.=C2=A0 From=C2=A0<a href=3D"http://mlton.org/MLBas=
isSyntaxAndSemantics">http://mlton.org/MLBasisSyntaxAndSemantics</a>: &quot=
;</span><font face=3D"courier new, monospace" size=3D"4">A reference to an =
SML source file causes the file to be elaborated in the basis extant at the=
 point of reference. A reference to an MLB file causes the basis denoted by=
 that MLB file to be imported=E2=80=89 =E2=80=94 =E2=80=89the basis at the =
point of reference does not affect the imported basis. ... A</font><span st=
yle=3D"font-family:&quot;courier new&quot;,monospace;font-size:large">n MLB=
 file is elaborated starting in an empty basis. Each MLB file is elaborated=
 and evaluated only once, with the result being cached. Subsequent referenc=
es use the cached value. Thus, any observable effects due to evaluation are=
 not duplicated if the MLB file is referred to multiple times.&quot;=C2=A0 =
In contrast, an SML source file that is referred to multiple times (whether=
 within the same MLB file or different MLB files) will be elaborated and ev=
aluated multiple times.=C2=A0 That&#39;s what&#39;s happening with &quot;sr=
c/Unicode/encoding.sml&quot;.=C2=A0 Even though it has a transparent signat=
ure match, its &quot;datatype&quot; declaration is generative, so the &quot=
;Encoding.Encoding&quot; type in &quot;parser.mlb&quot; is different from t=
he &quot;Encoding.Encoding&quot; type in &quot;encode.mlb&quot;.=C2=A0 To f=
ix the error, you would want to introduce a &quot;src/Unicode/encoding.mlb&=
quot; file that contains the only reference to &quot;src/Unicode/encoding.s=
ml&quot; and change the other references to &quot;src/Unicode/encoding.sml&=
quot; in other .mlb files to references to &quot;src/Unicode/encoding.mlb&q=
uot;.</span></div><div class=3D"gmail_default"><span style=3D"font-family:&=
quot;courier new&quot;,monospace;font-size:large"><br></span></div><div cla=
ss=3D"gmail_default"><span style=3D"font-family:&quot;courier new&quot;,mon=
ospace;font-size:large">-Matthew</span></div><div class=3D"gmail_default"><=
br></div><div class=3D"gmail_quote"><div dir=3D"ltr">On Tue, Oct 30, 2018 a=
t 7:22 AM &lt;<a href=3D"mailto:[email protected]">Michael.No=
[email protected]</a>&gt; wrote:<br></div><blockquote class=3D"gmail_qu=
ote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,20=
4);padding-left:1ex">





<div lang=3D"EN-AU">
<div class=3D"gmail-m_-1026278733828405541WordSection1">
<p class=3D"MsoNormal"><span lang=3D"EN-GB">Ha, it=E2=80=99s possible you s=
aw my fork of Chris=E2=80=99s repo rather than my original (I just dumped w=
hat wasn=E2=80=99t working and switched to his in the same place).=C2=A0 I=
=E2=80=99ve put the breaking repo at<u></u><u></u></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-GB"><u></u>=C2=A0<u></u></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-GB">=C2=A0 <a href=3D"https://githu=
b.com/mn200/fxp145" target=3D"_blank">https://github.com/mn200/fxp145</a><u=
></u><u></u></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-GB"><u></u>=C2=A0<u></u></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-GB">if you=E2=80=99re interested. <=
u></u><u></u></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-GB"><u></u>=C2=A0<u></u></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-GB">I was disturbed by the fact tha=
t the =E2=80=9Csame=E2=80=9D sequence of files fed to Poly/ML didn=E2=80=99=
t lead to any complaints.<u></u><u></u></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-GB"><u></u>=C2=A0<u></u></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-GB">Best,<u></u><u></u></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-GB">Michael<u></u><u></u></span></p=
>
<p class=3D"MsoNormal"><span lang=3D"EN-GB"><u></u>=C2=A0<u></u></span></p>
<div style=3D"border-right:none;border-bottom:none;border-left:none;border-=
top:1pt solid rgb(181,196,223);padding:3pt 0cm 0cm">
<p class=3D"MsoNormal"><b><span style=3D"font-size:12pt;color:black">From: =
</span></b><span style=3D"font-size:12pt;color:black">Matthew Fluet &lt;<a =
href=3D"mailto:[email protected]" target=3D"_blank">matthew.fluet@gma=
il.com</a>&gt;<br>
<b>Reply-To: </b>&quot;<a href=3D"mailto:[email protected]" target=3D"_b=
lank">[email protected]</a>&quot; &lt;<a href=3D"mailto:mlton-user@mlton=
.org" target=3D"_blank">[email protected]</a>&gt;<br>
<b>Date: </b>Tuesday, 30 October 2018 at 21:31<br>
<b>To: </b>MLton users &lt;<a href=3D"mailto:[email protected]" target=
=3D"_blank">[email protected]</a>&gt;<br>
<b>Cc: </b>&quot;<a href=3D"mailto:[email protected]" target=
=3D"_blank">[email protected]</a>&quot; &lt;<a href=3D"mailt=
o:[email protected]" target=3D"_blank">[email protected]=
ceforge.net</a>&gt;<br>
<b>Subject: </b>Re: [MLton-user] Failing to get FXP to work in mlton<u></u>=
<u></u></span></p>
</div>
<div>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
</div>
<div>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:18pt;font-family:&quot;Cour=
ier New&quot;">Michael,<u></u><u></u></span></p>
</div>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:18pt;font-family:&quot;Cour=
ier New&quot;">I couldn&#39;t recreate your type error with your fxp repo.=
=C2=A0 Compiling `src/Apps/Copy/copy.mlb` succeeded without error.=C2=A0 Th=
at said, the error that you quoted looks like a missing `sharing`
 or `where` constraint.<u></u><u></u></span></p>
</div>
<div>
<p class=3D"MsoNormal"><span style=3D"font-size:18pt;font-family:&quot;Cour=
ier New&quot;">-Matthew<u></u><u></u></span></p>
</div>
</div>
<p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p>
<div>
<div>
<p class=3D"MsoNormal">On Tue, Oct 30, 2018 at 5:45 AM Chris Cannam &lt;<a =
href=3D"mailto:[email protected]" target=3D"_blank">cannam@all-d=
ay-breakfast.com</a>&gt; wrote:<u></u><u></u></p>
</div>
<blockquote style=3D"border-top:none;border-right:none;border-bottom:none;b=
order-left:1pt solid rgb(204,204,204);padding:0cm 0cm 0cm 6pt;margin-left:4=
.8pt;margin-right:0cm">
<p class=3D"MsoNormal"><br>
<br>
On Mon, 29 Oct 2018, at 22:58, <a href=3D"mailto:[email protected]=
ro.au" target=3D"_blank">
[email protected]</a> wrote:<br>
&gt; That&#39;s great, thanks!=C2=A0 You have a better version of the under=
lying code <br>
&gt; too (2.0 vs 1.4.5).<br>
&gt; <br>
&gt; As for my compilation error, I tried to create one .mlb file per <br>
&gt; directory (more or less), whereas I see you put every core .sml file <=
br>
&gt; into the one fxplib.mlb file.<br>
<br>
Although I made a few fixes locally, most of the changes are from Timothy B=
ourke&#39;s patches at
<a href=3D"http://www.tbrk.org/software/sml-fxp.html" target=3D"_blank">htt=
p://www.tbrk.org/software/sml-fxp.html</a> - I just couldn&#39;t find an ex=
isting repo that tracked them. (Although I did say this in the commit log, =
I should probably also update the README
 to mention it... and also to update the build instructions.)<br>
<br>
<br>
Chris<br>
<br>
<br>
_______________________________________________<br>
MLton-user mailing list<br>
<a href=3D"mailto:[email protected]" target=3D"_blank">MLton=
[email protected]</a>;
<a href=3D"mailto:[email protected]" target=3D"_blank">mlton-user@mlton.=
org</a><br>
<a href=3D"https://lists.sourceforge.net/lists/listinfo/mlton-user" target=
=3D"_blank">https://lists.sourceforge.net/lists/listinfo/mlton-user</a><u><=
/u><u></u></p>
</blockquote>
</div>
</div>
</div>


<p></p>

-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;MLton-user&quot; group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:[email protected]" target=3D"_blan=
k">[email protected]</a>.<br>
_______________________________________________<br>
MLton-user mailing list<br>
<a href=3D"mailto:[email protected]" target=3D"_blank">MLton=
[email protected]</a>; <a href=3D"mailto:[email protected]" ta=
rget=3D"_blank">[email protected]</a><br>
<a href=3D"https://lists.sourceforge.net/lists/listinfo/mlton-user" rel=3D"=
noreferrer" target=3D"_blank">https://lists.sourceforge.net/lists/listinfo/=
mlton-user</a><br>
</blockquote></div></div></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;MLton-user&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:[email protected]">mlton-user+unsu=
[email protected]</a>.<br />

--0000000000002a9d9005797c0676--


--===============4482688327915185087==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============4482688327915185087==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
MLton-user mailing list
[email protected]; [email protected]
https://lists.sourceforge.net/lists/listinfo/mlton-user

--===============4482688327915185087==--