[GHC] #13321: Importing a bundled pattern "infects" all other imports of that pattern
GHC
ghc-devs at haskell.org
Thu Feb 23 21:42:44 UTC 2017
#13321: Importing a bundled pattern "infects" all other imports of that pattern
-------------------------------------+-------------------------------------
Reporter: ezyang | Owner: (none)
Type: bug | Status: new
Priority: low | Milestone:
Component: Compiler (Type | Version: 8.0.1
checker) |
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Description changed by ezyang:
Old description:
> Consider:
>
> {{{
> {-# LANGUAGE PatternSynonyms #-}
> unit p where
> module A0 where
> data G = G Int
> module A1 where
> import A0
> pattern X x = G x
> module A(G(X)) where
> import A0
> import A1
> module B(G) where
> import A
> module C(pattern X) where
> import A
> module D(N.G, pattern N.X) where
> import B
> import C
> import qualified A0 as N
> import qualified A1 as N
> }}}
>
> When we look at the interface for D, we see that N is bundled with D.
> This is a little surprising because I explicitly exported the G and X
> from A0 and A1, where no bundling took place.
>
> I suppose the current semantics might also be alright, but we should
> explicitly say so. The spec in the wiki is silent in this respect:
> https://ghc.haskell.org/trac/ghc/wiki/PatternSynonyms/AssociatingSynonyms
New description:
Consider:
{{{
{-# LANGUAGE PatternSynonyms #-}
unit p where
module A0 where
data G = G Int
module A1 where
import A0
pattern X x = G x
module A(G(X)) where
import A0
import A1
module B(G) where
import A
module C(pattern X) where
import A
module D(N.G, pattern N.X) where
import B
import C
import qualified A0 as N
import qualified A1 as N
}}}
When we look at the interface for D, we see that X is bundled with G. This
is a little surprising because I explicitly exported the G and X from A0
and A1, where no bundling took place.
I suppose the current semantics might also be alright, but we should
explicitly say so. The spec in the wiki is silent in this respect:
https://ghc.haskell.org/trac/ghc/wiki/PatternSynonyms/AssociatingSynonyms
--
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13321#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list