HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduletree-diff-0.3.4Haskell2010

Data.TreeDiff.Pretty

Utilities to pretty print Expr and EditExpr

  • 1 type
  • 16 values
  • Packagetree-diff-0.3.4
  • Exports17
  • LanguageHaskell2010
  • LicenceGPL-2.0-or-later
  • SourcePretty.hs

Explicit dictionary

4 declarations
datadata Pretty doc
#

Because we don't want to commit to single pretty printing library, we use explicit dictionary.

Constructors

valueppExpr :: Pretty doc -> Expr -> doc
#

Pretty print an Expr using explicit pretty-printing dictionary.

pretty

4 declarations
valueprettyExpr :: Expr -> Doc
#

Pretty print Expr using pretty.

Example1 expression
prettyExpr $ Rec "ex" (OMap.fromList [("[]", App "bar" [])])ex {`[]` = bar}

ansi-wl-pprint

4 declarations

background

Utilities

1 declaration
valueescapeName :: String -> String
#

Escape field or constructor name

Example1 expression
putStrLn $ escapeName "Foo"Foo
Example1 expression
putStrLn $ escapeName "_×_"_×_
Example1 expression
putStrLn $ escapeName "-3"`-3`
Example1 expression
putStrLn $ escapeName "kebab-case"kebab-case
Example1 expression
putStrLn $ escapeName "inner space"`inner space`
Example1 expression
putStrLn $ escapeName $ show "looks like a string""looks like a string"
Example1 expression
putStrLn $ escapeName $ show "tricky" ++ "   "`"tricky"   `
Example1 expression
putStrLn $ escapeName "[]"`[]`
Example1 expression
putStrLn $ escapeName "_,_"`_,_`