[GHC] #7989: "No constructor has all these fields" message can be improved

GHC ghc-devs at haskell.org
Mon Jun 17 11:58:36 CEST 2013


#7989: "No constructor has all these fields" message can be improved
-----------------------------+----------------------------------------------
Reporter:  akio              |          Owner:                  
    Type:  feature request   |         Status:  new             
Priority:  normal            |      Component:  Compiler        
 Version:  7.7               |       Keywords:                  
      Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
 Failure:  Other             |      Blockedby:                  
Blocking:                    |        Related:                  
-----------------------------+----------------------------------------------
 When a record update syntax contains fields from multiple constructors,
 you get an error message like this:

 {{{
 module Foo where

 data A = A {a0, a1 :: Int}
 data B = B {b0, b1 :: Int}

 f x = x { a0 = 3, a1 = 2, b0 = 4, b1 = 5 }
 }}}

 {{{
 datacon.hs:6:7:
     No constructor has all these fields: `a0', `a1', `b0', `b1'
     In the expression: x {a0 = 3, a1 = 2, b0 = 4, b1 = 5}
     In an equation for `f': f x = x {a0 = 3, a1 = 2, b0 = 4, b1 = 5}
 }}}

 However, this message becomes rather unhelpful when you are updating many
 (say 100) fields at once, because it doesn't say which field is causing
 the problem. I think it would be better if it only listed two conflicting
 field names like:

 {{{
     No constructor has these two fields: `a0', `b0'
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7989>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler



More information about the ghc-tickets mailing list