[GHC] #5728: Warnings from -fwarn-incomplete-record-updates even with all constructors matched

GHC cvs-ghc at haskell.org
Thu Mar 8 17:27:04 CET 2012


#5728: Warnings from -fwarn-incomplete-record-updates even with all constructors
matched
---------------------------------+------------------------------------------
    Reporter:  mjo               |       Owner:                                   
        Type:  bug               |      Status:  new                              
    Priority:  normal            |   Milestone:  _|_                              
   Component:  Compiler          |     Version:  7.4.1                            
    Keywords:  warnings          |          Os:  Unknown/Multiple                 
Architecture:  Unknown/Multiple  |     Failure:  Incorrect warning at compile-time
  Difficulty:  Unknown           |    Testcase:                                   
   Blockedby:                    |    Blocking:                                   
     Related:                    |  
---------------------------------+------------------------------------------

Comment(by maeder):

 This language extension has the disadvantage that:
   - the actual selector functions are shadowed and cannot be applied to
 other values in subexpressions
   - ".." binds variables that may conflict with other pattern variables,
 so that extending the record may break my update-code (in separate
 modules), like in:

 {{{
 {-# LANGUAGE RecordWildCards #-}
 data Rec = Mt | Rec {a, b, c, d, e, f, g, h, i :: Int}

 updA :: Int -> Rec -> Rec
 updA i Rec { .. } = Rec { a = i, .. }
 updA _ Mt = Mt
 }}}

 {{{
 Rec.hs:5:6:
     Conflicting definitions for `i'
     Bound at: Rec.hs:5:6
               Rec.hs:5:8-17
     In an equation for `updA'
 }}}

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



More information about the Glasgow-haskell-bugs mailing list