[Haskell-cafe] Bug in Hugs, Haskell behavior question

Derek Elkins derek.a.elkins at gmail.com
Fri Apr 4 21:49:41 EDT 2008


On Fri, 2008-04-04 at 18:34 -0700, Fritz Ruehr wrote:
> In lab the other day I was showing pattern bindings to a student and  
> broached a limiting case, one with no variables to be bound in the  
> pattern. I was surprised to find that Hugs crashed when I tried a  
> pattern binding at top level like this:
> 
> 	(2,[1,4],5) = (2,[1,4],5)
> 
> It also crashed on the simpler:
> 
> 	[2] = [2]
> 
> On the other hand, this turns out to be acceptable:
> 
> 	2 = 2
> 
> In fact, even this goes through without a hitch!
> 
> 	2 = 3
> 
> I'm not sure from the language definition yet whether this last  
> should give an "Unmatched pattern" error, but if it's intended  
> behavior, it does look a little odd.
> 
> Would anyone care to argue for or against allowing this?
> 
> In any case, the more structured patterns cause the latest (Sep 06)  
> Hugs release to crash, with "INTERNAL ERROR: compileGlobalFunction".
> 
> (GHC allows the strange "2 = 3" and handles the structured ones fine,  
> including even "(1,[2,3],4) = (4,[3,37],42)". I haven't checked any  
> other compilers.)


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



More information about the Haskell-Cafe mailing list