[Hugs] #46: Records aren't working properly when declared using 'newtype' syntax.

Hugs trac at galois.com
Sun Nov 12 23:11:15 EST 2006


#46: Records aren't working properly when declared using 'newtype' syntax.
----------------------------+-----------------------------------------------
 Reporter:  Elifant         |       Owner:  nobody      
     Type:  defect          |      Status:  new         
 Priority:  major           |   Milestone:  next release
Component:  hugs            |     Version:  200609      
 Keywords:  newtype record  |  
----------------------------+-----------------------------------------------
Test code:
 {{{
 newtype Test = Test { var :: String }
 main = print (var x)
      where x = Test { var = "a" }
 }}}

 Output:
 {{{
 "
 Program error: pattern match failure: instShow_v16_v1443 (Test_Test "a")
 }}}

 Records update is also broken:
 {{{
 newtype Test = Test { var :: String }
 main = print (var x{var="b"})
      where x = Test "a"
 }}}

 Output:
 {{{
 "
 Program error: pattern match failure: instShow_v16_v1443 (Test_Test "b")
 }}}

 It I change "newtype" with "data", all is OK.

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


More information about the Hugs-Bugs mailing list