Commit 99b4825c authored by simonmar's avatar simonmar
Browse files

[project @ 2001-08-15 15:50:41 by simonmar]

Aha!  I discovered how to distinguish ordinary record selectors from
class methods.

Prelude> :i +
-- + is a method in class Num
+ :: forall a. (Num a) => a -> a -> a
parent a27ef0b1
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
-- $Id: InteractiveUI.hs,v 1.88 2001/08/15 15:39:59 simonmar Exp $ -- $Id: InteractiveUI.hs,v 1.89 2001/08/15 15:50:41 simonmar Exp $
-- --
-- GHC Interactive User Interface -- GHC Interactive User Interface
-- --
...@@ -25,9 +25,11 @@ import DriverUtil ...@@ -25,9 +25,11 @@ import DriverUtil
import Linker import Linker
import Finder ( flushPackageCache ) import Finder ( flushPackageCache )
import Util import Util
import Id ( isRecordSelector, isDataConWrapId, idName ) import Id ( isRecordSelector, recordSelectorFieldLabel,
isDataConWrapId, idName )
import Class ( className ) import Class ( className )
import TyCon ( tyConName ) import TyCon ( tyConName, tyConClass_maybe )
import FieldLabel ( fieldLabelTyCon )
import SrcLoc ( isGoodSrcLoc ) import SrcLoc ( isGoodSrcLoc )
import Name ( Name, isHomePackageName, nameSrcLoc ) import Name ( Name, isHomePackageName, nameSrcLoc )
import Outputable import Outputable
...@@ -399,12 +401,16 @@ info s = do ...@@ -399,12 +401,16 @@ info s = do
showTyThing (ATyCon ty) showTyThing (ATyCon ty)
= hcat [ppr ty, text " is a type constructor", showSrcLoc (tyConName ty)] = hcat [ppr ty, text " is a type constructor", showSrcLoc (tyConName ty)]
showTyThing (AnId id) showTyThing (AnId id)
= hcat [ppr id, text " is a ", text (idDescr id), showSrcLoc (idName id)] = hcat [ppr id, text " is a ", idDescr id, showSrcLoc (idName id)]
idDescr id idDescr id
| isRecordSelector id = "record selector" | isRecordSelector id =
| isDataConWrapId id = "data constructor" case tyConClass_maybe (fieldLabelTyCon (
| otherwise = "variable" 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 -- also print out the source location for home things
showSrcLoc name showSrcLoc name
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment