[prev in list] [next in list] [prev in thread] [next in thread]
List: hugs-bugs
Subject: Re: [Haskell-cafe] Bug in Hugs, Haskell behavior question
From: Fritz Ruehr <fruehr () willamette ! edu>
Date: 2008-04-05 3:15:48
Message-ID: 2EC84037-F999-4AC0-92CA-C1C59AF119F4 () willamette ! edu
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
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 <fruehr@willamette.edu> 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
[Attachment #5 (unknown)]
<html><body style="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> -- Fritz</div><div \
style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: \
after-white-space; "><div><br class="Apple-interchange-newline">On Fri 4 Apr 08, at \
6:49 pm, Derek Elkins wrote:</div><div><br><blockquote type="cite"><div \
style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; \
"><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal \
Helvetica; ">Top-level bindings are irrefutable, so 2 = 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="Apple-interchange-newline"><blockquote \
type="cite"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; \
margin-left: 0px; ">On 4/4/08, Fritz Ruehr <<a \
href="mailto:fruehr@willamette.edu">fruehr@willamette.edu</a>> wrote:</div> \
<blockquote type="cite"><div style="margin-top: 0px; margin-right: 0px; \
margin-bottom: 0px; margin-left: 0px; ">In fact, even this goes through without a \
hitch!</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; \
margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; \
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span \
class="Apple-converted-space"> </span>2 = 3</div> </blockquote><div \
style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; \
min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; \
margin-bottom: 0px; margin-left: 0px; ">This is hilarious.</div><div \
style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; \
min-height: 14px; "><br></div><div style="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="margin-top: 0px; margin-right: 0px; \
margin-bottom: 0px; margin-left: 0px; ">Or at least a warning?</div><div \
style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; \
min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; \
margin-bottom: 0px; margin-left: 0px; ">In ghci:</div><div style="margin-top: 0px; \
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; \
"><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; \
margin-left: 0px; ">Prelude> let 2 = 3</div><div style="margin-top: 0px; \
margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">-- no problem</div><div \
style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; \
">Prelude> let (2,x) = (3,4)</div><div style="margin-top: 0px; margin-right: 0px; \
margin-bottom: 0px; margin-left: 0px; ">-- no problem</div><div style="margin-top: \
0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Prelude> x</div><div \
style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; \
">*** Exception: <interactive>:1:4-16: Irrefutable pattern match failed</div><div \
style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; \
">for pattern (2,x)</div><div style="margin-top: 0px; margin-right: 0px; \
margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div \
style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; \
"><span class="Apple-converted-space"> </span>-- ryan</div> \
</blockquote></div><br></body></html>
_______________________________________________
Hugs-Bugs mailing list
Hugs-Bugs@haskell.org
http://www.haskell.org/mailman/listinfo/hugs-bugs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic