diff options
author | Krzysztof Gogolewski <krzysztof.gogolewski@tweag.io> | 2020-09-12 23:06:21 +0200 |
---|---|---|
committer | Krzysztof Gogolewski <krzysztof.gogolewski@tweag.io> | 2020-09-13 14:01:07 +0200 |
commit | 379e4de0d59b88c3d3fcae3bc26c4f32a9e51c73 (patch) | |
tree | d8366553cacd5ff7fced33e9dfc40a9327bf0b4a | |
parent | 8440b5fa1397940f2f293935927e690b34110a73 (diff) | |
download | haskell-wip/T18302.tar.gz |
WIP on #18302wip/T18302
Culprit:
pickGREsModExp :: ModuleName -> [GlobalRdrElt] -> [(GlobalRdrElt,GlobalRdrElt)]
-- ^ Pick GREs that are in scope *both* qualified *and* unqualified
-- Return each GRE that is, as a pair
-- (qual_gre, unqual_gre)
-- These two GREs are the original GRE with imports filtered to express how
-- it is in scope qualified an unqualified respectively
--
-- Used only for the 'module M' item in export list;
-- see 'GHC.Tc.Gen.Export.exports_from_avail'
pickGREsModExp mod gres = mapMaybe (pickBothGRE mod) gres
pickBothGRE :: ModuleName -> GlobalRdrElt -> Maybe (GlobalRdrElt, GlobalRdrElt)
pickBothGRE mod gre@(GRE { gre_name = n })
| isBuiltInSyntax n = Nothing
| Just gre1 <- pickQualGRE mod gre
, Just gre2 <- pickUnqualGRE gre = Just (gre1, gre2)
| otherwise = Nothing
where
-- isBuiltInSyntax filter out names for built-in syntax They
-- just clutter up the environment (esp tuples), and the
-- parser will generate Exact RdrNames for them, so the
-- cluttered envt is no use. Really, it's only useful for
-- GHC.Base and GHC.Tuple.
-rw-r--r-- | compiler/GHC/Builtin/Types/Prim.hs | 11 | ||||
-rw-r--r-- | libraries/base/Data/Typeable/Internal.hs | 3 | ||||
-rw-r--r-- | libraries/base/GHC/Exception.hs | 1 | ||||
-rwxr-xr-x | libraries/base/GHC/Exts.hs | 3 | ||||
-rw-r--r-- | libraries/base/Unsafe/Coerce.hs | 2 |
5 files changed, 4 insertions, 16 deletions
diff --git a/compiler/GHC/Builtin/Types/Prim.hs b/compiler/GHC/Builtin/Types/Prim.hs index e631e04baa..87ed9be07e 100644 --- a/compiler/GHC/Builtin/Types/Prim.hs +++ b/compiler/GHC/Builtin/Types/Prim.hs @@ -11,8 +11,6 @@ Wired-in knowledge about primitive types -- | This module defines TyCons that can't be expressed in Haskell. -- They are all, therefore, wired-in TyCons. C.f module "GHC.Builtin.Types" module GHC.Builtin.Types.Prim( - mkPrimTyConName, -- For implicit parameters in GHC.Builtin.Types only - mkTemplateKindVars, mkTemplateTyVars, mkTemplateTyVarsFrom, mkTemplateKiTyVars, mkTemplateKiTyVar, @@ -402,7 +400,7 @@ multiplicityTyVar = mkTemplateTyVars (repeat multiplicityTy) !! 13 -- selects ' -} funTyConName :: Name -funTyConName = mkPrimTyConName (fsLit "FUN") funTyConKey funTyCon +funTyConName = mkPrimTcName UserSyntax (fsLit "FUN") funTyConKey funTyCon -- | The @FUN@ type constructor. -- @@ -536,12 +534,7 @@ tYPETyCon = mkKindTyCon tYPETyConName -- If you edit these, you may need to update the GHC formalism -- See Note [GHC Formalism] in GHC.Core.Lint -tYPETyConName = mkPrimTyConName (fsLit "TYPE") tYPETyConKey tYPETyCon - -mkPrimTyConName :: FastString -> Unique -> TyCon -> Name -mkPrimTyConName = mkPrimTcName BuiltInSyntax - -- All of the super kinds and kinds are defined in Prim, - -- and use BuiltInSyntax, because they are never in scope in the source +tYPETyConName = mkPrimTcName UserSyntax (fsLit "TYPE") tYPETyConKey tYPETyCon mkPrimTcName :: BuiltInSyntax -> FastString -> Unique -> TyCon -> Name mkPrimTcName built_in_syntax occ key tycon diff --git a/libraries/base/Data/Typeable/Internal.hs b/libraries/base/Data/Typeable/Internal.hs index 7ac590a829..e28557bfd7 100644 --- a/libraries/base/Data/Typeable/Internal.hs +++ b/libraries/base/Data/Typeable/Internal.hs @@ -82,10 +82,9 @@ module Data.Typeable.Internal ( typeSymbolTypeRep, typeNatTypeRep, ) where -import GHC.Prim ( FUN ) import GHC.Base import qualified GHC.Arr as A -import GHC.Types ( TYPE, Multiplicity (Many) ) +import GHC.Types ( Multiplicity (Many) ) import Data.Type.Equality import GHC.List ( splitAt, foldl', elem ) import GHC.Word diff --git a/libraries/base/GHC/Exception.hs b/libraries/base/GHC/Exception.hs index cd71891abd..134bfbf3c0 100644 --- a/libraries/base/GHC/Exception.hs +++ b/libraries/base/GHC/Exception.hs @@ -38,7 +38,6 @@ import GHC.Base import GHC.Show import GHC.Stack.Types import GHC.OldList -import GHC.Prim import GHC.IO.Unsafe import {-# SOURCE #-} GHC.Stack.CCS import GHC.Exception.Type diff --git a/libraries/base/GHC/Exts.hs b/libraries/base/GHC/Exts.hs index fc8bb1ef0c..045b147adf 100755 --- a/libraries/base/GHC/Exts.hs +++ b/libraries/base/GHC/Exts.hs @@ -34,7 +34,6 @@ module GHC.Exts maxTupleSize, -- * Primitive operations - FUN, -- See https://gitlab.haskell.org/ghc/ghc/issues/18302 module GHC.Prim, module GHC.Prim.Ext, shiftL#, shiftRL#, iShiftL#, iShiftRA#, iShiftRL#, @@ -91,7 +90,7 @@ module GHC.Exts type (~~), -- * Representation polymorphism - GHC.Prim.TYPE, RuntimeRep(..), VecCount(..), VecElem(..), + RuntimeRep(..), VecCount(..), VecElem(..), -- * Transform comprehensions Down(..), groupWith, sortWith, the, diff --git a/libraries/base/Unsafe/Coerce.hs b/libraries/base/Unsafe/Coerce.hs index 0e899ef37a..75302dadc4 100644 --- a/libraries/base/Unsafe/Coerce.hs +++ b/libraries/base/Unsafe/Coerce.hs @@ -24,8 +24,6 @@ import GHC.Arr (amap) -- For amap/unsafeCoerce rule import GHC.Base import GHC.Num.Integer () -- See Note [Depend on GHC.Num.Integer] in GHC.Base -import GHC.Types - {- Note [Implementing unsafeCoerce] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The implementation of unsafeCoerce is surprisingly subtle. |