Re: Bug in Hugs, Haskell behavior question

Fritz Ruehr <[email protected]> Fri, 4 Apr 2008 20:15:48 -0700
Newsgroups gmane.comp.lang.haskell.cafe,gmane.comp.lang.haskell.hugs.bugs
Message-ID <[email protected]>
--===============0037727983==
Content-Type: multipart/alternative; boundary=Apple-Mail-1--722601587


--Apple-Mail-1--722601587
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	delsp=yes;
	format=flowed

Derek: yes, I caught this in the language description not long after  
hitting "send": I had forgotten about that.

But then I anticipated the behavior Ryan shows below, where using a  
variable that's part of a "strange" pattern will cause an error (I  
didn't want to check it while driving home--cell phone user/drivers  
are bad enough!--so thanks, Ryan, for verifying :) ).

In any case, opinions about the behavior aside, there is a Hugs  
internal error here, so I hope that much is useful.

The strange cases make for interesting academic discussions, at least.

   --  Fritz

On Fri 4 Apr 08, at 6:49 pm, Derek Elkins wrote:

> Top-level bindings are irrefutable, so 2 = 3 is fine, if vacuous.

On Fri 4 Apr 08, at 6:53 pm, Ryan Ingram wrote:

> On 4/4/08, Fritz Ruehr <[email protected]> wrote:
>> In fact, even this goes through without a hitch!
>>
>>        2 = 3
>
> This is hilarious.
>
> Maybe bindings that don't actually bind anything should be an error?
> Or at least a warning?
>
> In ghci:
>
> Prelude> let 2 = 3
> -- no problem
> Prelude> let (2,x) = (3,4)
> -- no problem
> Prelude> x
> *** Exception: <interactive>:1:4-16: Irrefutable pattern match failed
> for pattern (2,x)
>
>   -- ryan


--Apple-Mail-1--722601587
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=ISO-8859-1

<html><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =
-webkit-line-break: after-white-space; ">
<div>Derek: yes, I caught this in the language description not long =
after hitting "send": I had forgotten about =
that.</div><div><br></div><div>But then I anticipated the behavior Ryan =
shows below, where using a variable that's part of a "strange" pattern =
will cause an error (I didn't want to check it while driving home--cell =
phone user/drivers are bad enough!--so thanks, Ryan, for verifying :) =
).</div><div><br></div><div>In any case, opinions about the behavior =
aside, there is a Hugs internal error here, so I hope that much is =
useful.</div><div><br></div><div>The strange cases make for interesting =
academic discussions, at least.</div><div><br></div><div>=A0=A0-- =
=A0Fritz</div><div style=3D"word-wrap: break-word; -webkit-nbsp-mode: =
space; -webkit-line-break: after-white-space; "><div><br =
class=3D"Apple-interchange-newline">On Fri 4 Apr 08, at 6:49 pm, Derek =
Elkins wrote:</div><div><br><blockquote type=3D"cite"><div =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; "><font face=3D"Helvetica" size=3D"3" style=3D"font: =
normal normal normal 12px/normal Helvetica; ">Top-level bindings are =
irrefutable, so 2 =3D 3 is fine, if =
vacuous.</font></div></blockquote><br></div></div><div><html>On Fri 4 =
Apr 08, at 6:53 pm, Ryan Ingram wrote:</html><br =
class=3D"Apple-interchange-newline"><blockquote type=3D"cite"><div =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; ">On 4/4/08, Fritz Ruehr &lt;<a =
href=3D"mailto:[email protected]">[email protected]</a>> =
wrote:</div> <blockquote type=3D"cite"><div style=3D"margin-top: 0px; =
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">In fact, even =
this goes through without a hitch!</div><div style=3D"margin-top: 0px; =
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: =
14px; "><br></div><div style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; "><span =
class=3D"Apple-converted-space">=A0=A0 =A0 =A0 </span>2 =3D 3</div> =
</blockquote><div style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; ">This is hilarious.</div><div style=3D"margin-top: =
0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; =
min-height: 14px; "><br></div><div style=3D"margin-top: 0px; =
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Maybe =
bindings that don't actually bind anything should be an error?</div><div =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; ">Or at least a warning?</div><div style=3D"margin-top: =
0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; =
min-height: 14px; "><br></div><div style=3D"margin-top: 0px; =
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">In =
ghci:</div><div style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; ">Prelude> let 2 =3D 3</div><div style=3D"margin-top: =
0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-- no =
problem</div><div style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; ">Prelude> let (2,x) =3D =
(3,4)</div><div style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; ">-- no problem</div><div =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; ">Prelude> x</div><div style=3D"margin-top: 0px; =
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">*** =
Exception: &lt;interactive>:1:4-16: Irrefutable pattern match =
failed</div><div style=3D"margin-top: 0px; margin-right: 0px; =
margin-bottom: 0px; margin-left: 0px; ">for pattern (2,x)</div><div =
style=3D"margin-top: 0px; margin-right: 0px; margin-bottom: 0px; =
margin-left: 0px; min-height: 14px; "><br></div><div style=3D"margin-top: =
0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span =
class=3D"Apple-converted-space">=A0 </span>-- ryan</div> =
</blockquote></div><br></body></html>=

--Apple-Mail-1--722601587--

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

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

--===============0037727983==--