[GHC] #13307: Record pattern synonym fields have to be manually exported
GHC
ghc-devs at haskell.org
Mon Feb 20 11:41:17 UTC 2017
#13307: Record pattern synonym fields have to be manually exported
-------------------------------------+-------------------------------------
Reporter: ocharles | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.2
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
The following currently fails to compile:
{{{#!hs
{-# LANGUAGE PatternSynonyms #-}
module A
( T(T)
) where
data Impl = Impl Int
newtype T = MkT Impl
pattern T {x} = MkT (Impl x)
{-# LANGUAGE RecordWildCards #-}
module B where
import A
foo :: T -> Int
foo T{x} = x
}}}
As far as GHC can see, in module `B`, `T` does not have a field `x`. The
fix is to manually export `x` from `A`:
{{{#!hs
module A (T(T, x)) where
}}}
But this is tedious for records with a large amount of fields
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13307>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list