[cvs-nhc98] Fix a bug in translating (n+k) patterns to code.

Malcolm Wallace malcolm@sparud.net
Fri, 14 Sep 2001 18:12:58 +0200 (CEST)


malcolm: Fri Sep 14 18:12:57 CEST 2001

Update of /usr/src/master/nhc/src/compiler98
In directory hinken:/tmp/cvs-serv722

Modified Files:
	Case.hs 
Log Message:
Fix a bug in translating (n+k) patterns to code.

  The symptom was that
      foo (n+1) Foo = 1
      foo (n+1) Bar = 2
      foo _ _ = 3
      main = print (foo 1 Bar)
  was offering 3 as result, not 2 as expected.

  The cause was that the two equations were being matched in an
  nested if..then..else sequence, with (n>=1) as the condition.
  The correct way is to sequence the matches with FATBAR, so the
  second match is actually attempted.