-----------------------------------------------------------------------------
--- $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
--
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
\ :cd <dir> change directory to <dir>\n\
\ :def <cmd> <expr> define a command :<cmd>\n\
\ :help, :? display this list of commands\n\
-\ :info [<name> ...] display information about the given names, or\n\
-\ about currently loaded files if no names given\n\
+\ :info [<name> ...] display information about the given names\n\
\ :load <filename> ... load module(s) and their dependents\n\
\ :module <mod> set the context for expression evaluation to <mod>\n\
\ :reload reload the current module set\n\
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