FsPretty


FsPretty

This library is an implementation of the pretty printer combinator library described by Philip Wadler in "A Prettier Printer", (available at CiteSeer). It is based on the Haskell wl-pprint implementation.

The FsPretty library can be installed from NuGet:
PM> Install-Package FsPretty

Example

The goal of the library is to allow documents to be assembled easily via a set of functional combinators. For example, a list of integers can be turned into a tuple via:

1: 
2: 
3: 
4: 
5: 
6: 
7: 
8: 
#r "FsPretty.dll"
open FsPretty.PrettyPrint
open FsPretty.Rendering

let mylist = List.map mkint [1;2;3]
             |> encloseSep lparen rparen comma

printfn "mylist = %s" <| displayString mylist

Samples & documentation

The following are available as documentation. Please note that the documentation is currently under active development.

  • Tutorial contains a further explanation of this sample library.

  • API Reference contains automatically generated documentation for all types, modules and functions in the library. This includes additional brief samples on using most of the functions.

Contributing and copyright

The project is hosted on GitHub where you can report issues, fork the project and submit pull requests. If you're adding a new public API, please also consider adding samples that can be turned into a documentation. You might also want to read the library design notes to understand how it works.

For license information see the License file in the GitHub repository.

val mylist : obj

Full name: Index.mylist
Multiple items
module List

from Microsoft.FSharp.Collections

--------------------
type List<'T> =
  | ( [] )
  | ( :: ) of Head: 'T * Tail: 'T list
  interface IEnumerable
  interface IEnumerable<'T>
  member Head : 'T
  member IsEmpty : bool
  member Item : index:int -> 'T with get
  member Length : int
  member Tail : 'T list
  static member Cons : head:'T * tail:'T list -> 'T list
  static member Empty : 'T list

Full name: Microsoft.FSharp.Collections.List<_>
val map : mapping:('T -> 'U) -> list:'T list -> 'U list

Full name: Microsoft.FSharp.Collections.List.map
val printfn : format:Printf.TextWriterFormat<'T> -> 'T

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printfn
Fork me on GitHub