From 9035ad450dc7927dff4bafd4d66314fb9df1b4d8 Mon Sep 17 00:00:00 2001 From: simonmar Date: Mon, 20 Aug 2001 16:17:17 +0000 Subject: [PATCH] [project @ 2001-08-20 16:17:17 by simonmar] - be more informative about primitive types: they are identified as such, and a declaration is printed out as if the thing was an abstract data type (this at least tells you what the arity of the tycon is). - print 'infix 4 elem' as 'infix 4 `elem`'. --- ghc/compiler/ghci/InteractiveUI.hs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/ghc/compiler/ghci/InteractiveUI.hs b/ghc/compiler/ghci/InteractiveUI.hs index af0faad..e291d6f 100644 --- a/ghc/compiler/ghci/InteractiveUI.hs +++ b/ghc/compiler/ghci/InteractiveUI.hs @@ -1,5 +1,5 @@ ----------------------------------------------------------------------------- --- $Id: InteractiveUI.hs,v 1.90 2001/08/16 10:54:22 simonmar Exp $ +-- $Id: InteractiveUI.hs,v 1.91 2001/08/20 16:17:17 simonmar Exp $ -- -- GHC Interactive User Interface -- @@ -28,10 +28,12 @@ import Util import Id ( isRecordSelector, recordSelectorFieldLabel, isDataConWrapId, idName ) import Class ( className ) -import TyCon ( tyConName, tyConClass_maybe ) +import TyCon ( tyConName, tyConClass_maybe, isPrimTyCon ) import FieldLabel ( fieldLabelTyCon ) import SrcLoc ( isGoodSrcLoc ) -import Name ( Name, isHomePackageName, nameSrcLoc, NamedThing(..) ) +import Name ( Name, isHomePackageName, nameSrcLoc, nameOccName, + NamedThing(..) ) +import OccName ( isSymOcc ) import BasicTypes ( defaultFixity ) import Outputable import CmdLineOpts ( DynFlag(..), getDynFlags, saveDynFlags, restoreDynFlags, dopt_unset ) @@ -401,11 +403,17 @@ info s = do showFixity fix name | fix == defaultFixity = empty - | otherwise = ppr fix <+> ppr name + | otherwise = ppr fix <+> + (if isSymOcc (nameOccName name) + then ppr name + else char '`' <> ppr name <> char '`') - showTyThing (AClass cl) + showTyThing (AClass cl) = hcat [ppr cl, text " is a class", showSrcLoc (className cl)] showTyThing (ATyCon ty) + | isPrimTyCon ty + = hcat [ppr ty, text " is a primitive type constructor"] + | otherwise = hcat [ppr ty, text " is a type constructor", showSrcLoc (tyConName ty)] showTyThing (AnId id) = hcat [ppr id, text " is a ", idDescr id, showSrcLoc (idName id)] -- 1.7.10.4