diff options
Diffstat (limited to 'compiler/prelude/PrelInfo.hs')
| -rw-r--r-- | compiler/prelude/PrelInfo.hs | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/compiler/prelude/PrelInfo.hs b/compiler/prelude/PrelInfo.hs index 8e26d80a6a..47f41fbf73 100644 --- a/compiler/prelude/PrelInfo.hs +++ b/compiler/prelude/PrelInfo.hs @@ -21,6 +21,7 @@ module PrelInfo ( -- * Known-key names isKnownKeyName, lookupKnownKeyName, + lookupKnownNameInfo, -- ** Internal use -- | 'knownKeyNames' is exported to seed the original name cache only; @@ -59,6 +60,7 @@ import Id import Name import NameEnv import MkId +import Outputable import TysPrim import TysWiredIn import HscTypes @@ -66,7 +68,6 @@ import Class import TyCon import UniqFM import Util -import Panic import {-# SOURCE #-} TcTypeNats ( typeNatTyCons ) import Control.Applicative ((<|>)) @@ -197,6 +198,22 @@ isKnownKeyName n = knownKeysMap :: UniqFM Name knownKeysMap = listToUFM [ (nameUnique n, n) | n <- knownKeyNames ] +-- | Given a 'Unique' lookup any associated arbitrary SDoc's to be displayed by +-- GHCi's ':info' command. +lookupKnownNameInfo :: Name -> SDoc +lookupKnownNameInfo name = case lookupNameEnv knownNamesInfo name of + -- If we do find a doc, we add comment delimeters to make the output + -- of ':info' valid Haskell. + Nothing -> empty + Just doc -> vcat [text "{-", doc, text "-}"] + +-- A map from Uniques to SDocs, used in GHCi's ':info' command. (#12390) +knownNamesInfo :: NameEnv SDoc +knownNamesInfo = unitNameEnv coercibleTyConName $ + vcat [ text "Coercible is a special constraint with custom solving rules." + , text "It is not a class." + , text "Please see section 9.14.4 of the user's guide for details." ] + {- We let a lot of "non-standard" values be visible, so that we can make sense of them in interface pragmas. It's cool, though they all have |
