Skip to content
  • Simon Peyton Jones's avatar
    Add debugPprType · 805b29bb
    Simon Peyton Jones authored
    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
    805b29bb