HORIZON HASKELLDocslts/ghc-9.14.x3e2d5682026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · 3e2d568 · 2026-10-11

Moduletree-diff-0.4.1Haskell2010

Data.TreeDiff.Pretty

Utilities to pretty print Expr and EditExpr

  • 1 type
  • 16 values
  • Packagetree-diff-0.4.1
  • 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}

prettyprinter

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 "_,_"`_,_`