Apache-2.0 licensed by Sergey Vinokurov
Maintained by Sergey Vinokurov
This version can be pinned in stack with:prettyprinter-combinators-0.1.4@sha256:fb01ffa29cf2168fca235b1043ace24cce9c2c4ee4e09844f8bec890c213431c,2232

build

This is a set of utilities for the Haskell prettyrinter package. Most notable is automatic deriving of Pretty instance from the Generic instance, e.g.

{-# LANGUAGE DeriveGeneric #-}

import Prettyprinter.Generics

data Foo a b = Bar Int | Baz a b
  deriving (Generic)

instance (Pretty a, Pretty b) => Pretty (Foo a b) where
  pretty = ppGeneric

printed :: Doc ann
printed = pretty $ Baz (Bar 10 :: Foo () ()) [1..22]

which would put following into printed:

Baz
  Bar 10
  [ 1
  , 2
  , 3
  , 4
  , 5
  , 6
  , 7
  , 8
  , 9
  , 10
  , 11
  , 12
  , 13
  , 14
  , 15
  , 16
  , 17
  , 18
  , 19
  , 20
  , 21
  , 22 ]

Changes

0.1.4

  • Add hPutDocLn
  • Add ppUTCTimeISO8601. Add dependency on time boot package.
  • Add ppOsString from os-string package
  • Add reasonable default implementation for methods for ppGenericOverride class method
  • Add generic deriving for more types from base package like Data.Functor.Compose
  • Add opt-in Pretty.Instances module with orphan instances. Other modules don’t reexport it, intended for quick(er) debugging sessions where we don’t care about orphans and want to print something on the screen as soon as possible.

0.1.3

  • Add functions for rendering with specified layout options
  • Add pretty functions for types of enummapset package, could be disabled with enummapset flag
  • Fix build with GHC 9.10

0.1.2

  • Fix build with GHC 9.8
  • Add PPGeneric newtype to apply ppGeneric through DerivingVia
  • Add PPShow newtype to apply ppShow through DerivingVia

0.1.1.1

  • ppVector and ppVectorWith now accept generic vectors
  • Add lower bound pretty-show >= 1.6