HORIZON HASKELLDocslts/ghc-10.0.x77a86622026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 77a8662 · 2026-10-31

Generic representation of values

datadata Value

Generic Haskell values. NaN and Infinity are represented as constructors. The String in the literals is the text for the literals "as is".

A chain of infix constructors means that they appeared in the input string without parentheses, i.e

1 :+: 2 :*: 3 is represented with InfixCons 1 [(":+:",2),(":*:",3)], whereas

1 :+: (2 :*: 3) is represented with InfixCons 1 [(":+:",InfixCons 2 [(":*:",3)])].

Constructors

Instances2Eq, Show
  • Eq ValueDefined in pretty-show-1.10 · Text.Show.Value
  • Show ValueDefined in pretty-show-1.10 · Text.Show.Value
valuevalToStr :: Value -> String

Pretty print a generic value. Our intention is that the result is equivalent to the Show instance for the original value, except possibly easier to understand by a human.

valuevalToDoc :: Value -> Doc

Pretty print a generic value. Our intention is that the result is equivalent to the Show instance for the original value, except possibly easier to understand by a human.

Values using the Show class

valueppDoc :: Show a => a -> Doc

Try to show a value, prettily. If we do not understand the value, then we just use its standard Show instance.

valuepPrint :: Show a => a -> IO ()

Pretty print a generic value to stdout. This is particularly useful in the GHCi interactive environment.

Working with listlike ("foldable") collections

valueppDocList :: (Foldable f, Show a) => f a -> Doc

Pretty print something that may be converted to a list as a list. Each entry is on a separate line, which means that we don't do clever pretty printing, and so this works well for large strucutures.

valueppShowList :: (Foldable f, Show a) => f a -> String

Pretty print something that may be converted to a list as a list. Each entry is on a separate line, which means that we don't do clever pretty printing, and so this works well for large strucutures.

valuepPrintList :: (Foldable f, Show a) => f a -> IO ()

Pretty print something that may be converted to a list as a list. Each entry is on a separate line, which means that we don't do clever pretty printing, and so this works well for large strucutures.

Values using the PrettyVal class

classclass PrettyVal a where

A class for types that may be reified into a value. Instances of this class may be derived automatically, for datatypes that support Generics.

Methods

Instances27PrettyVal, …

Rendering values to Html

Get location of data files

The location of the directory specified by Cabal's --datadir option (where architecture-independent data files are installed). This can be overridden at runtime using the environment variable pretty_show_datadir.

Preprocessing of values

valueppHideNested :: (Name -> Bool) -> a -> PreProc a

Hide the given constructors when showing a value. In addition, hide values if all of their children were hidden.

valuehideCon :: Bool -> (Name -> Bool) -> Value -> Value

Hide constrcutros matching the given predicate. If the hidden value is in a record, we also hide the corresponding record field.

If the boolean flag is true, then we also hide constructors all of whose fields were hidden.

Deprecated