diff options
author | Simon Marlow <marlowsd@gmail.com> | 2011-09-16 13:40:53 +0100 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2011-09-21 09:52:59 +0100 |
commit | 3db757241ce7fb99c096c30481aefa86bb9855a1 (patch) | |
tree | 003ea696a39cf558b975cc4d4b0e7bd88c0867ad /compiler/utils | |
parent | 9de6f19e5de702967a9411b01c06734d3b67eea8 (diff) | |
download | haskell-3db757241ce7fb99c096c30481aefa86bb9855a1.tar.gz |
Add support for all top-level declarations to GHCi
This is work mostly done by Daniel Winograd-Cort during his
internship at MSR Cambridge, with some further refactoring by me.
This commit adds support to GHCi for most top-level declarations that
can be used in Haskell source files. Class, data, newtype, type,
instance are all supported, as are Type Family-related declarations.
The current set of declarations are shown by :show bindings. As with
variable bindings, entities bound by newer declarations shadow earlier
ones.
Tests are in testsuite/tests/ghci/scripts/ghci039--ghci054.
Documentation to follow.
Diffstat (limited to 'compiler/utils')
-rw-r--r-- | compiler/utils/Outputable.lhs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/utils/Outputable.lhs b/compiler/utils/Outputable.lhs index 8cfb8e2919..833309e6aa 100644 --- a/compiler/utils/Outputable.lhs +++ b/compiler/utils/Outputable.lhs @@ -70,7 +70,7 @@ module Outputable ( ) where import {-# SOURCE #-} Module( Module, ModuleName, moduleName ) -import {-# SOURCE #-} OccName( OccName ) +import {-# SOURCE #-} Name( Name, nameModule ) import StaticFlags import FastString @@ -145,7 +145,7 @@ data Depth = AllTheWay -- as @Exception.catch@, this fuction will return @Just "Exception"@. -- Note that the return value is a ModuleName, not a Module, because -- in source code, names are qualified by ModuleNames. -type QueryQualifyName = Module -> OccName -> QualifyName +type QueryQualifyName = Name -> QualifyName -- See Note [Printing original names] in HscTypes data QualifyName -- given P:M.T @@ -166,10 +166,10 @@ type QueryQualifyModule = Module -> Bool type PrintUnqualified = (QueryQualifyName, QueryQualifyModule) alwaysQualifyNames :: QueryQualifyName -alwaysQualifyNames m _ = NameQual (moduleName m) +alwaysQualifyNames n = NameQual (moduleName (nameModule n)) neverQualifyNames :: QueryQualifyName -neverQualifyNames _ _ = NameUnqual +neverQualifyNames _ = NameUnqual alwaysQualifyModules :: QueryQualifyModule alwaysQualifyModules _ = True @@ -278,8 +278,8 @@ getPprStyle df = SDoc $ \ctx -> runSDoc (df (sdocStyle ctx)) ctx \begin{code} qualName :: PprStyle -> QueryQualifyName -qualName (PprUser (qual_name,_) _) m n = qual_name m n -qualName _other m _n = NameQual (moduleName m) +qualName (PprUser (qual_name,_) _) n = qual_name n +qualName _other n = NameQual (moduleName (nameModule n)) qualModule :: PprStyle -> QueryQualifyModule qualModule (PprUser (_,qual_mod) _) m = qual_mod m |