[Hugs] #48: record patterns fail on newtypes

Hugs trac at galois.com
Tue Nov 14 04:03:32 EST 2006


#48: record patterns fail on newtypes
--------------------+-------------------------------------------------------
 Reporter:  ross    |       Owner:  nobody
     Type:  defect  |      Status:  new   
 Priority:  major   |   Milestone:        
Component:  hugs    |     Version:  200609
 Keywords:          |  
--------------------+-------------------------------------------------------
Given the declaration
 {{{
 newtype T = C { f :: String }
 }}}
 Hugs exhibits the following misbehaviour:
 {{{
 Newtype> case C "abc" of C { f = v } -> v
 "bc"
 Newtype> case undefined of C {} -> True

 Program error: Prelude.undefined
 }}}
 The non-record versions are fine:
 {{{
 Newtype> case C "abc" of C v -> v
 "abc"
 Newtype> case undefined of C _ -> True
 True
 }}}
 The internal representation of `newtype`s elides the data constructor, but
 the record pattern-matching code treats them like `data` types (see also
 #46).

-- 
Ticket URL: <http://hackage.haskell.org/trac/hugs/ticket/48>
Hugs <http://www.haskell.org/hugs/>
Hugs 98, an interpreter for Haskell


More information about the Hugs-Bugs mailing list