X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Fghci%2FInteractiveUI.hs;h=31cae902ec1dbdfb5c23fde6f8fcab288da146d2;hb=99b4825c2a570767e9fa4ceab786476b07c7ac59;hp=f75c6726eb1c369f66933f26d49562450e6e01b0;hpb=dd6f34b632c29306e56b6bdf232316af26800a4f;p=ghc-hetmet.git diff --git a/ghc/compiler/ghci/InteractiveUI.hs b/ghc/compiler/ghci/InteractiveUI.hs index f75c672..31cae90 100644 --- a/ghc/compiler/ghci/InteractiveUI.hs +++ b/ghc/compiler/ghci/InteractiveUI.hs @@ -1,5 +1,5 @@ ----------------------------------------------------------------------------- --- $Id: InteractiveUI.hs,v 1.86 2001/08/15 14:40:24 simonmar Exp $ +-- $Id: InteractiveUI.hs,v 1.89 2001/08/15 15:50:41 simonmar Exp $ -- -- GHC Interactive User Interface -- @@ -25,9 +25,11 @@ import DriverUtil import Linker import Finder ( flushPackageCache ) import Util -import Id ( isDataConWrapId, idName ) +import Id ( isRecordSelector, recordSelectorFieldLabel, + isDataConWrapId, idName ) import Class ( className ) -import TyCon ( tyConName ) +import TyCon ( tyConName, tyConClass_maybe ) +import FieldLabel ( fieldLabelTyCon ) import SrcLoc ( isGoodSrcLoc ) import Name ( Name, isHomePackageName, nameSrcLoc ) import Outputable @@ -101,8 +103,7 @@ helpText = "\ \ :cd change directory to \n\ \ :def define a command :\n\ \ :help, :? display this list of commands\n\ -\ :info [ ...] display information about the given names, or\n\ -\ about currently loaded files if no names given\n\ +\ :info [ ...] display information about the given names\n\ \ :load ... load module(s) and their dependents\n\ \ :module set the context for expression evaluation to \n\ \ :reload reload the current module set\n\ @@ -400,10 +401,16 @@ info s = do showTyThing (ATyCon ty) = hcat [ppr ty, text " is a type constructor", showSrcLoc (tyConName ty)] showTyThing (AnId id) - | isDataConWrapId id - = hcat [ppr id, text " is a data constructor", showSrcLoc (idName id)] - | otherwise - = hcat [ppr id, text " is a variable", showSrcLoc (idName id)] + = hcat [ppr id, text " is a ", idDescr id, showSrcLoc (idName id)] + + idDescr id + | isRecordSelector id = + case tyConClass_maybe (fieldLabelTyCon ( + recordSelectorFieldLabel id)) of + Nothing -> text "record selector" + Just c -> text "method in class " <> ppr c + | isDataConWrapId id = text "data constructor" + | otherwise = text "variable" -- also print out the source location for home things showSrcLoc name