Package

purescript-motsunabe

Repository
justinwoo/purescript-motsunabe
License
MIT
Uploaded by
justinwoo
Published on
2019-06-13T14:37:11Z

Build Status

A trivial implementation of Wadler's Prettier Printer.

Example

from tests:

main = do
  assert $ pretty 80 emptyDoc == "\n"
  assert $ prettyWithoutTrailing 80 emptyDoc == ""
  assert $ pretty 80 stringDoc == "hello i am 24 chars long\n"
  assert $ pretty 80 alt == "hello i am 24 chars longhello i am 24 chars long\n"
  assert $ pretty 30 alt == "hello i am 24 chars long\nhello i am 24 chars long\n"
  assert $ pretty 80 nest == "hello i am 24 chars long\n  hello i am 24 chars long\n"
  where
    emptyDoc = DNil
    stringDoc = DText "hello i am 24 chars long"
    alt = DAlt (stringDoc <> stringDoc) (stringDoc <> DLine <> stringDoc)
    nest = stringDoc <> DNest 1 (DLine <> stringDoc)
Modules
Motsunabe
Dependencies