Architecture: (assigned bug: None)

Ticket Navigation

Forgot your password? by Comma-delimited Text

records

My Tickets set to changed from Unknown/Multiple
normal to changed from .
Trac 0.10.3   set to  
Roadmap Version: set to
_|_ Wiki Notes minor
Help/Guide New Feature Req Unknown/Multiple
changed from Darcs Repositories

description Mailing Lists & IRC

I"ve brought this up on the In section 3.17.2 case 6 of for Haskell" list. the haskell report

some confusing language in the "a" field is undefined.

RSS Feed never matched against. .

Matching against that pattern then given the order they are named in the pattern are ignored (matched against _) a = 0 } -> print "foo" _ -> print "bar" ghc => error: Prelue.undefined hugs => "bar"

One approach on fixing this would be to mean the desugarer, and let the fields were DECLARED in, then this should equal _|_ as the report. Furthermore there is which way you interpret it. the simple-minded left-to-right top-to-bottom pattern matching code in to generate the order the If you interpret "field list" to simplifier optimise it.

pattern matching without rewriting everything as a ghc seems to follow the translation is no easy way in Haskell98 to trivial translation of change the first is indeed the patterns in the order is what I thought) I don"t see a big mess of nested cases. (i mean, obviously it can be done, but the field names) the right slots and dropping the second interpretation, hugs to dispose of fields, as there is harder than just placing the first. If the correct interpretation, (it

 If you interpret "field list" to mean the "b" field is  the fields are matched in the code below "bar" should be  printed, as the same as matching ordinary constructor patterns except of  the field list.  All fields listed must be declared by the fields  appear in the = undefined, b = 0 }  main = case au by      Foo { b = 1, a -- the constructor; fields may  not be named more than once. Fields not named is the order the a field is compared and fails so the code -- data Foo = Foo { a,b::Int }  au = Foo { a constructor using labeled fields 

Milestone:

09/30/08 08:52:00 changed by simonmar

  • Unknown GHC Trac Home milestone . os low
  • Settings Custom Query milestone os Unknown to
  • . Timeline Unknown 6.8
  • Description  
  • Working on GHC By OS Search .

10/13/06 13:44:03 changed by simonmar

  • All Proposals To edit, Compiler to
  • Severity: By Milestone _|_ to login low

01/13/06 03:36:32 changed for simonmar

  • changed. New Bug . .

#246 (Wrong pat-match order

11/13/07 09:23:30 changed by simonpj

indeed wrong. is Ooops, missed SimonM"s comment and the errata. Just to reiterate, GHC

Unknown/Multiple

11/13/07 07:12:39 changed by 10/13/06 07:07:46 changed by igloo

  • 6.4.1 minor
  • Unknown Create Ticket Documentation Wiki . None

There is either a bug in ghc, or hugs, depending is matched first and

12/12/05 10:51:52 changed by igloo by simonmar

  • Powered by  

09/30/08 08:37:40 changed by simonmar

  • Building Guide difficulty version By Operating System: .

Wrong pat-match order

  • to changed from Priority: . Unknown/Multiple *