[prev in list] [next in list] [prev in thread] [next in thread] 

List:       nhc-cvs
Subject:    [cvs-nhc98] Fix a bug in translating (n+k) patterns to code.
From:       malcolm () sparud ! net (Malcolm Wallace)
Date:       2001-09-14 16:12:58
Message-ID: 20010914161258.A8C20D91C () mail ! sparud ! net
[Download RAW message or body]

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.



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic