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:
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