[GHC] #11051: GHCi with +t option set shows type representations
GHC
ghc-devs at haskell.org
Sat Jan 9 19:18:56 UTC 2016
#11051: GHCi with +t option set shows type representations
-------------------------------------+-------------------------------------
Reporter: bgamari | Owner: bgamari
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.11
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Incorrect result | Unknown/Multiple
at runtime | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by bgamari):
My guess is that we'd want to do something like this to ensure that
`System` names never make it to the user.
{{{#!patch
diff --git a/compiler/main/InteractiveEval.hs
b/compiler/main/InteractiveEval.hs
index 013be3c..d3020d7 100644
--- a/compiler/main/InteractiveEval.hs
+++ b/compiler/main/InteractiveEval.hs
@@ -235,8 +235,9 @@ runStmtWithLocation source linenumber expr step = do
runDecls :: GhcMonad m => String -> m [Name]
runDecls = runDeclsWithLocation "<interactive>" 1
-runDeclsWithLocation
- :: GhcMonad m => String -> Int -> String -> m [Name]
+-- | Run some declarations and return any user-visible names that were
brought
+-- into scope.
+runDeclsWithLocation :: GhcMonad m => String -> Int -> String -> m [Name]
runDeclsWithLocation source linenumber expr =
do
hsc_env <- getSession
@@ -246,7 +247,13 @@ runDeclsWithLocation source linenumber expr =
hsc_env <- getSession
hsc_env' <- liftIO $ rttiEnvironment hsc_env
modifySession (\_ -> hsc_env')
- return (map getName tyThings)
+
+ -- Trac #11051: We filter out system names since the user is not
interested
+ -- in them. These include,
+ -- * Data family tycons from, e.g., derived Generic instances
+ -- * Type representation (Typeable) definitions (e.g. $trMyModule)
+ -- * others
+ return $ filter (not . isSystemName) $ map getName tyThings
}}}
With this we've reduced the problem to ensuring that the generated
Typeable identifiers get marked as `System` names. Currently they are
conjured by up `IfaceEnv.newGlobalBinder` which only knows how to produce
`External` names.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11051#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list