[GHC] #11343: Unable to infer type when using DuplicateRecordFields

GHC ghc-devs at haskell.org
Mon Jan 4 11:39:42 UTC 2016


#11343: Unable to infer type when using DuplicateRecordFields
-------------------------------------+-------------------------------------
        Reporter:  mpickering        |                Owner:  adamgundry
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  7.11
  checker)                           |
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by adamgundry):

 * owner:   => adamgundry
 * failure:  None/Unknown => GHC rejects valid program
 * component:  Compiler => Compiler (Type checker)
 * version:  7.10.3 => 7.11
 * type:  bug => feature request


Comment:

 By design, we don't do any inference to determine which record type is
 meant in this kind of situation. Instead, the type must be pushed in to
 the update, or the record expression being updated must have a type
 signature. Thus either of these should work:
 {{{#!hs
   print (aThing { a = 5 } :: A)
   print ((bThing :: B) { a = 5 } )
 }}}

 I suppose we could add a special case for when the record expression is a
 variable whose type is known, which would cover this example. I'm not sure
 if it's a good idea to accumulate too many special cases, but perhaps this
 case is common enough that it's worthwhile?

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11343#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list