[GHC] #13352: Strange requirement for re-exported duplicate record fields

GHC ghc-devs at haskell.org
Tue Feb 28 19:50:17 UTC 2017


#13352: Strange requirement for re-exported duplicate record fields
-------------------------------------+-------------------------------------
           Reporter:  crockeea       |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.2
           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:
-------------------------------------+-------------------------------------
 In the following example,

 {{{
 module A(A(..)) where
 data A = A {x::Int}

 module B(B(..)) where
 data B = B {x::Bool}

 {-# LANGUAGE DuplicateRecordFields #-}
 module C(A(..),B(..)) where
 import A(A(..))
 import B(B(..))
 }}}

 I get an error about `conflicting exports for 'x'`. This doesn't seem
 right to me: I've got `-XDuplicateRecordFields` exactly where the
 duplicate occurs.

 However, I noticed that the if I move the pragma to A.hs, C.hs compiles
 without error:

 {{{
 {-# LANGUAGE DuplicateRecordFields #-}
 module A(A(..)) where
 data A = A {x::Int}

 module B(B(..)) where
 data B = B {x::Bool}

 module C(A(..),B(..)) where
 import A(A(..))
 import B(B(..))
 }}}

 This is bizarre because it is asymmetric (I arbitrarily put the pragma in
 A.hs, but it need not occur in B.hs), and because no duplicate records
 exist in module A, but they ''do'' exist in module C, where the pragma
 isn't needed.

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


More information about the ghc-tickets mailing list