Add debugPprType
authorSimon Peyton Jones <simonpj@microsoft.com>
Wed, 30 Aug 2017 07:57:40 +0000 (08:57 +0100)
committerSimon Peyton Jones <simonpj@microsoft.com>
Thu, 31 Aug 2017 07:16:58 +0000 (08:16 +0100)
commit805b29bb873c792ca5bcbd5540026848f9f11a8d
tree993291054fd388c0e493d11175ec27922d61bb1f
parentfca196280d38d07a697fbccdd8527821206b33eb
Add debugPprType

We pretty-print a type by converting it to an IfaceType and
pretty-printing that.  But
 (a) that's a bit indirect, and
 (b) delibrately loses information about (e.g.) the kind
      on the /occurrences/ of a type variable

So this patch implements debugPprType, which pretty prints
the type directly, with no fancy formatting.  It's just used
for debugging.

I took the opportunity to refactor the debug-pretty-printing
machinery a little.  In particular, define these functions
and use them:

  ifPprDeubug :: SDoc -> SDOc -> SDoc
    -- Says what to do with and without -dppr-debug
  whenPprDebug :: SDoc -> SDoc
    -- Says what to do with  -dppr-debug; without is empty
  getPprDebug :: (Bool -> SDoc) -> SDoc

getPprDebug used to be called sdocPprDebugWith
whenPprDebug used to be called ifPprDebug

So a lot of files get touched in a very mechanical way
32 files changed:
compiler/basicTypes/BasicTypes.hs
compiler/basicTypes/RdrName.hs
compiler/basicTypes/SrcLoc.hs
compiler/coreSyn/CoreLint.hs
compiler/coreSyn/PprCore.hs
compiler/deSugar/Desugar.hs
compiler/ghci/RtClosureInspect.hs
compiler/hsSyn/HsBinds.hs
compiler/hsSyn/HsExpr.hs
compiler/hsSyn/HsLit.hs
compiler/hsSyn/HsPat.hs
compiler/hsSyn/HsTypes.hs
compiler/iface/IfaceSyn.hs
compiler/iface/IfaceType.hs
compiler/iface/LoadIface.hs
compiler/nativeGen/Dwarf/Types.hs
compiler/nativeGen/X86/Ppr.hs
compiler/prelude/ForeignCall.hs
compiler/profiling/CostCentre.hs
compiler/simplCore/CoreMonad.hs
compiler/simplCore/SimplUtils.hs
compiler/specialise/Rules.hs
compiler/specialise/Specialise.hs
compiler/stgSyn/StgSyn.hs
compiler/typecheck/TcRnDriver.hs
compiler/typecheck/TcRnTypes.hs
compiler/typecheck/TcSMonad.hs
compiler/typecheck/TcTyClsDecls.hs
compiler/types/FamInstEnv.hs
compiler/types/InstEnv.hs
compiler/types/TyCoRep.hs
compiler/utils/Outputable.hs