Skip to content

Commit

Permalink
Prepare for preview release
Browse files Browse the repository at this point in the history
- rename to »prettyprinter«
- don’t export Unicode module until I know where to put it
- update README
  • Loading branch information
quchen committed May 20, 2017
1 parent 9a69227 commit bc78400
Show file tree
Hide file tree
Showing 53 changed files with 111 additions and 93 deletions.
53 changes: 32 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,27 @@



Prettyprinter à la Wadler/Leijen
================================

<span style="color: red">This project is not officially released yet. Since it
is reasonably stable and bug-free, you’re invited to try it out; I (quchen) used
it in production for months. Please do not publish it on my behalf though, I’d
like to do this myself once I’m happy with everything. :-) </span>
A modern Wadler/Leijen Prettyprinter
====================================

[![status](https://img.shields.io/github/release/quchen/prettyprinter.svg?style=flat-square&label=Latest%20version)](https://github.com/quchen/prettyprinter/releases)
[![status](https://img.shields.io/travis/quchen/prettyprinter/master.svg?style=flat-square&label=Master%20build)](https://travis-ci.org/quchen/prettyprinter)

This module defines a prettyprinter to format text in a flexible and convenient


tl;dr
-----

A prettyprinter/text rendering engine. Easy to use, well-documented, ANSI
terminal backend exists, HTML backend is trivial to implement, no name clashes,
Text-based, extensible.



Longer; want to read
--------------------

This package defines a prettyprinter to format text in a flexible and convenient
way. The idea is to combine a document out of many small components, then using
a layouter to convert it to an easily renderable simple document, which can then
be rendered to a variety of formats, for example plain `Text`, or Markdown.
Expand Down Expand Up @@ -108,21 +117,23 @@ exposed in a semi-internal module for this specific use case.



The wl-pprint family
--------------------
The prettyprinter family
------------------------

The `prettyprinter` family of packages consists of:

The `wl-pprint` family of packages consists of:

- `wl-pprint` is the core package. It defines the language to generate nicely
laid out documents, which can then be given to renderers to display them in
various ways, e.g. HTML, or plain text.
- `wl-pprint-ansi` provides a renderer suitable for ANSI terminal output
including colors (at the cost of a dependency more).
- `wl-pprint-compat-old` provides a drop-in compatibility layer for previous
users of the old `wl-pprint`. Use it for easy adaption of the new
`wl-pprint`, but don't develop anything new with it.
- `wl-pprint-compat-old-ansi` is the same, but for previous users of
- `prettyprinter` is the core package. It defines the language to generate
nicely laid out documents, which can then be given to renderers to display
them in various ways, e.g. HTML, or plain text.
- `prettyprinter-ansi-terminal` provides a renderer suitable for ANSI terminal
output including colors (at the cost of a dependency more).
- `prettyprinter-compat-wl-pprint` provides a drop-in compatibility layer for
previous users of the `wl-pprint` package. Use it for easy adaption of the
new `prettyprinter`, but don't develop anything new with it.
- `prettyprinter-compat-ansi-wl-pprint` is the same, but for previous users of
`ansi-wl-pprint`.
- `prettyprinter-compat-annotated-wl-pprint` is the same, but for previous
users of `annotated-wl-pprint`.



Expand Down
9 changes: 5 additions & 4 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
-- http://cabal.readthedocs.io/en/latest/nix-local-build-overview.html

packages: wl-pprint
, wl-pprint-ansi
, wl-pprint-compat-old
, wl-pprint-compat-old-ansi
packages: 'prettyprinter'
, 'prettyprinter-ansi-terminal'
, 'prettyprinter-compat-wl-pprint'
, 'prettyprinter-compat-ansi-wl-pprint'
, 'prettyprinter-compat-annotated-wl-pprint'

tests: true
benchmarks: true
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: wl-pprint-ansi
version: 1
name: prettyprinter-ansi-terminal
version: 0.1
cabal-version: >= 1.10
category: User Interfaces, Text
synopsis: ANSI terminal backend for the modern, extensible and well-documented prettyprinter.
Expand Down Expand Up @@ -35,7 +35,7 @@ library
base < 127
, ansi-terminal >= 0.4.0 && < 0.7
, text
, wl-pprint
, prettyprinter >= 0 && < 0.2

if impl(ghc >= 8.0)
ghc-options: -Wcompat
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: wl-pprint-compat-old-annotated-wl-pprint
version: 1
name: prettyprinter-compat-annotated-wl-pprint
version: 0.1
cabal-version: >= 1.10
category: User Interfaces, Text
synopsis: Prettyprinter compatibility module for previous users of the annotated-wl-pprint package.
Expand Down Expand Up @@ -29,4 +29,4 @@ library
build-depends:
base < 127
, text
, wl-pprint
, prettyprinter >= 0 && < 0.2
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: wl-pprint-compat-old-ansi
version: 1
name: prettyprinter-compat-ansi-wl-pprint
version: 0.1
cabal-version: >= 1.10
category: User Interfaces, Text
synopsis: Prettyprinter compatibility module for previous users of the ansi-wl-pprint package.
Expand Down Expand Up @@ -31,5 +31,5 @@ library
build-depends:
base < 127
, text
, wl-pprint
, wl-pprint-ansi
, prettyprinter >= 0 && < 0.2
, prettyprinter-ansi-terminal >= 0 && < 0.2
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: wl-pprint-compat-old
name: prettyprinter-compat-wl-pprint
version: 1
cabal-version: >= 1.10
category: User Interfaces, Text
Expand Down Expand Up @@ -31,4 +31,4 @@ library
build-depends:
base < 127
, text
, wl-pprint
, prettyprinter >= 0 && < 0.2
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,26 @@ readmeContents :: Doc ann
readmeContents = (mconcat . L.intersperse vspace)
[ htmlComment "This file was auto-generated by the 'scripts/generate_readme' program."

, h1 "Prettyprinter à la Wadler/Leijen"

, paragraph [multiline| <span style="color: red">This project is not
officially released yet. Since it is reasonably stable and bug-free, you’re
invited to try it out; I (quchen) used it in production for months. Please
do not publish it on my behalf though, I’d like to do this myself once I’m
happy with everything. :-) </span>|]
, h1 "A modern Wadler/Leijen Prettyprinter"

, cat
[ "[![status](https://img.shields.io/github/release/quchen/prettyprinter.svg?style=flat-square&label=Latest%20version)](https://github.com/quchen/prettyprinter/releases)"
, "[![status](https://img.shields.io/travis/quchen/prettyprinter/master.svg?style=flat-square&label=Master%20build)](https://travis-ci.org/quchen/prettyprinter)"
]

, paragraph [multiline| This module defines a prettyprinter to format text
in a flexible and convenient way. The idea is to combine a document out of
many small components, then using a layouter to convert it to an easily
renderable simple document, which can then be rendered to a variety of
formats, for example plain `Text`, or Markdown. *What you are reading right
now was generated by this library (see `GenerateReadme.hs`).* |]
, h2 "tl;dr"
, paragraph [multiline| A prettyprinter/text rendering engine. Easy to
use, well-documented, ANSI terminal backend exists, HTML backend is
trivial to implement, no name clashes, Text-based, extensible. |]

, h2 "Longer; want to read"
, paragraph [multiline| This package defines a prettyprinter to format
text in a flexible and convenient way. The idea is to combine a document
out of many small components, then using a layouter to convert it to an
easily renderable simple document, which can then be rendered to a
variety of formats, for example plain `Text`, or Markdown. *What you are
reading right now was generated by this library (see
`GenerateReadme.hs`).* |]

, h2 "Why another prettyprinter?"
, paragraph [multiline| Haskell, more specifically Hackage, has a zoo of
Expand Down Expand Up @@ -115,21 +116,24 @@ readmeContents = (mconcat . L.intersperse vspace)
island of incompatibility. For this reason, the `Doc` type is fully
exposed in a semi-internal module for this specific use case. |]


, h2 "The wl-pprint family"
, paragraph "The `wl-pprint` family of packages consists of:"
, h2 "The prettyprinter family"
, paragraph "The `prettyprinter` family of packages consists of:"
, (indent 2 . unorderedList . map paragraph)
[ [multiline| `wl-pprint` is the core package. It defines the language
to generate nicely laid out documents, which can then be given to
renderers to display them in various ways, e.g. HTML, or plain text.|]
, [multiline| `wl-pprint-ansi` provides a renderer suitable for ANSI
terminal output including colors (at the cost of a dependency more).|]
, [multiline| `wl-pprint-compat-old` provides a drop-in compatibility
layer for previous users of the old `wl-pprint`. Use it for easy
adaption of the new `wl-pprint`, but don't develop anything new with
it.|]
, [multiline| `wl-pprint-compat-old-ansi` is the same, but for previous
users of `ansi-wl-pprint`.|]
[ [multiline| `prettyprinter` is the core package. It defines the
language to generate nicely laid out documents, which can then be
given to renderers to display them in various ways, e.g. HTML, or
plain text.|]
, [multiline| `prettyprinter-ansi-terminal` provides a renderer suitable
for ANSI terminal output including colors (at the cost of a
dependency more).|]
, [multiline| `prettyprinter-compat-wl-pprint` provides a drop-in
compatibility layer for previous users of the `wl-pprint` package. Use
it for easy adaption of the new `prettyprinter`, but don't develop
anything new with it.|]
, [multiline| `prettyprinter-compat-ansi-wl-pprint` is the same, but for
previous users of `ansi-wl-pprint`.|]
, [multiline| `prettyprinter-compat-annotated-wl-pprint` is the same,
but for previous users of `annotated-wl-pprint`.|]
]

, h2 "Differences to the old Wadler/Leijen prettyprinters"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
20 changes: 11 additions & 9 deletions wl-pprint/wl-pprint.cabal → prettyprinter/prettyprinter.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: wl-pprint
version: 1
name: prettyprinter
version: 0.1
cabal-version: >= 1.10
category: User Interfaces, Text
synopsis: A modern, extensible and well-documented prettyprinter.
Expand Down Expand Up @@ -35,8 +35,9 @@ library
, Data.Text.Prettyprint.Doc.Render.Util.Panic
, Data.Text.Prettyprint.Doc.Render.Util.SimpleDocTree
, Data.Text.Prettyprint.Doc.Render.Util.StackMachine
, Data.Text.Prettyprint.Doc.Unicode
, Data.Text.Prettyprint.Doc.Util
-- Hidden for now, until I figure out where to put it:
-- , Data.Text.Prettyprint.Doc.Unicode
ghc-options: -Wall
hs-source-dirs: src
include-dirs: aux
Expand Down Expand Up @@ -68,7 +69,7 @@ executable generate_readme
main-is: GenerateReadme.hs
build-depends:
base < 127
, wl-pprint
, prettyprinter
, text
, template-haskell
default-language: Haskell2010
Expand Down Expand Up @@ -100,7 +101,7 @@ test-suite testsuite
main-is: Main.hs
build-depends:
base
, wl-pprint
, prettyprinter

, pgp-wordlist
, bytestring
Expand All @@ -121,13 +122,14 @@ benchmark fusion
main-is: Fusion.hs
build-depends:
base
, wl-pprint
, ansi-wl-pprint
, prettyprinter

, criterion
, mtl
, random
, text
, transformers
, mtl
, ansi-wl-pprint
ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N
default-language: Haskell2010
other-extensions: NumDecimals, OverloadedStrings
Expand All @@ -136,7 +138,7 @@ benchmark faster-unsafe-text
build-depends: base >= 4.7 && < 5
, criterion
, text
, wl-pprint
, prettyprinter

hs-source-dirs: bench
main-is: FasterUnsafeText.hs
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions scripts/benchmark
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pwd

OUTDIR="${PROJECT_ROOT}/generated"
mkdir -p "$OUTDIR"
stack bench wl-pprint \
stack bench prettyprinter:bench:fusion \
--benchmark-arguments "--output \"$OUTDIR/wl-pprint-benchmark.html\""
stack bench faster-unsafe-text \
stack bench prettyprinter:bench:faster-unsafe-text \
--benchmark-arguments "--output \"$OUTDIR/faster-unsafe-text.html\""
14 changes: 7 additions & 7 deletions scripts/checks/stylish-haskell
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ stylish-haskell --version

cd "$(stack path --project-root)"
git stash
find wl-pprint* -name "*.hs" -exec stylish-haskell --inplace {} \;
find prettyprinter* -name "*.hs" -exec stylish-haskell --inplace {} \;

cd "$(git rev-parse --show-toplevel)"
set +e
Expand All @@ -15,11 +15,11 @@ EXIT=$?
set -e

if [[ $EXIT -ne 0 ]]; then
echo '╭────────────────────────────────────────────────────────────────────╮'
echo '│ Stylish-Haskell introduced changes. │'
echo '│ Please run it before committing! │'
echo '│ │'
echo '│ find wl-pprint* -name "*.hs" -exec stylish-haskell --inplace {} \; │'
echo '╰────────────────────────────────────────────────────────────────────╯'
echo '╭────────────────────────────────────────────────────────────────────────'
echo '│ Stylish-Haskell introduced changes. '
echo '│ Please run it before committing! '
echo ' '
echo '│ find prettyprinter* -name "*.hs" -exec stylish-haskell --inplace {} \; │'
echo '╰────────────────────────────────────────────────────────────────────────'
fi
exit $EXIT
2 changes: 1 addition & 1 deletion scripts/generate_readme
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ set -v
cd "$(git rev-parse --show-toplevel)"
pwd

stack build wl-pprint:exe:generate_readme
stack build prettyprinter:exe:generate_readme
stack exec generate_readme > README.md
10 changes: 5 additions & 5 deletions stack-older-snapshots.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
resolver: lts-7.13
packages:
- 'wl-pprint'
- 'wl-pprint-ansi'
- 'wl-pprint-compat-old'
- 'wl-pprint-compat-old-ansi'
- 'wl-pprint-compat-old-annotated-wl-pprint'
- 'prettyprinter'
- 'prettyprinter-ansi-terminal'
- 'prettyprinter-compat-wl-pprint'
- 'prettyprinter-compat-ansi-wl-pprint'
- 'prettyprinter-compat-annotated-wl-pprint'
extra-deps:
- pgp-wordlist-0.1.0.2
flags: {}
Expand Down
10 changes: 5 additions & 5 deletions stack.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
resolver: lts-8.0
packages:
- 'wl-pprint'
- 'wl-pprint-ansi'
- 'wl-pprint-compat-old'
- 'wl-pprint-compat-old-ansi'
- 'wl-pprint-compat-old-annotated-wl-pprint'
- 'prettyprinter'
- 'prettyprinter-ansi-terminal'
- 'prettyprinter-compat-wl-pprint'
- 'prettyprinter-compat-ansi-wl-pprint'
- 'prettyprinter-compat-annotated-wl-pprint'
extra-deps: []
flags: {}
extra-package-dbs: []

0 comments on commit bc78400

Please sign in to comment.