HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduleprettyprinter-1.7.1Haskell2010

Prettyprinter.Internal.Debug

Warning: internal module! This means that the API may change arbitrarily between versions without notice. Depending on this module may lead to unexpected breakages, so proceed with caution!

This module provides debugging helpers for inspecting Docs.

Use the pretty-simple package to get a nicer layout for shown Diags:

> Text.Pretty.Simple.pPrintNoColor . diag $ align (vcat ["foo", "bar"])
Column
   [
       ( 10
       , Nesting
           [
               ( 10
               , Cat ( Text 3 "foo" )
                   ( Cat ( FlatAlt Line Empty ) ( Text 3 "bar" ) )
               )
           ]
       )
   ]
  • 1 type
  • 2 values
datadata Diag ann
#

A variant of Doc for debugging.

Unlike in the Doc type, the Column, WithPageWidth and Nesting constructors don't contain functions but are "sampled" to allow simple inspection with show.

Constructors

Instances1Show
  • Show ann => Show (Diag ann)Defined in prettyprinter-1.7.1 · Prettyprinter.Internal.Debug
valuediag :: Doc ann -> Diag ann
#

Convert a Doc to its diagnostic representation.

The functions in the Column, WithPageWidth and Nesting constructors are sampled with some default values.

Use diag' to control the function inputs yourself.

Example1 expression
diag $ Doc.align (Doc.vcat ["foo", "bar"])Column [(10,Nesting [(10,Cat (Text 3 "foo") (Cat (FlatAlt Line Empty) (Text 3 "bar")))])]