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

Fritz Ruehr fruehr at willamette.edu
Fri Apr 4 21:34:12 EDT 2008

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.)

   --  Fritz

More information about the Haskell-Cafe mailing list