pretty-sop

A generic pretty-printer using generics-sop

LTS Haskell 14.1:0.2.0.3
Stackage Nightly 2019-08-18:0.2.0.3
Latest on Hackage:0.2.0.3

See all snapshots pretty-sop appears in

BSD-3-Clause licensed by Edsko de Vries, Andres Löh
Maintained by andres@well-typed.com

Module documentation for 0.2.0.3

This version can be pinned in stack with:pretty-sop-0.2.0.3@sha256:b1ebdd5db5affed4b2b8bbbf0ca214475f82664c3268073d083bbf9db91acb01,2692
## pretty-sop

[![Build Status](https://travis-ci.org/well-typed/pretty-sop.svg?branch=master)](https://travis-ci.org/well-typed/pretty-sop)
[![Hackage](https://img.shields.io/hackage/v/pretty-sop.svg)](https://hackage.haskell.org/package/pretty-sop)

This library contains a generic implementation of the `prettyVal` function
from the [pretty-show](https://hackage.haskell.org/package/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](https://github.com/well-typed/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
[Hackage](https://hackage.haskell.org/package/pretty-sop).


## Example

```haskell
{-# 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:

```text
Car { name = test , seats = 3 }
```
comments powered byDisqus