A generic pretty-printer using generics-sop

Version on this page:
LTS Haskell 13.22:
Stackage Nightly 2019-05-23:
Latest on Hackage:

See all snapshots pretty-sop appears in

BSD-3-Clause licensed by Edsko de Vries, Andres Löh
Maintained by

Module documentation for

## pretty-sop

[![Build Status](](

This library contains a generic implementation of the `prettyVal` function
from the [pretty-show]( package.
Using the pretty printer, values can easily be rendered to strings and HTML
documents in a uniform way.

This library makes use of the [generics-sop](
package and is an example of a generic function defined in the SOP style.

This is the development repository. For releases, look on

## Example

{-# LANGUAGE DeriveGeneric #-}

import Generics.SOP.PrettyVal
import Generics.SOP
import qualified GHC.Generics as G
import Text.Show.Pretty

data Car = Car
{ name :: String
, seats :: Int
} deriving (G.Generic)

instance Generic Car
instance HasDatatypeInfo Car
instance PrettyVal Car where
prettyVal = gprettyVal

main :: IO ()
main = putStrLn $ dumpStr $ Car "test" 3

would print:

Car { name = test , seats = 3 }
Depends on 3 packages:
Used by 1 package:
comments powered byDisqus