BSD-3-Clause licensed by Tobias Dammers
Maintained by [email protected]
This version can be pinned in stack with:wryte-0.2.0.0@sha256:d3cd65926a1db64429de74c7438e7aaa8a9784bbdbdb870361ddbf3cf9b059b4,993

Module documentation for 0.2.0.0

Depends on 3 packages(full list with versions):
Used by 1 package in nightly-2017-06-19(full list with versions):

wryte

Pretty-printed source code with semi-automatic indentation

Introduction

Wryte provides an API for generating textual source code with pretty indentation and alignment. To achieve this, it tracks source column position, newlines, and current indentation / alignment internally, and provides a monadic API to conveniently manage these.

Installation

The usual; cabal install wryte, or add wryte to your stack extra-dependencies.

Basic Usage

putStrLn . runWryte_ defWryteOptions $ do
  wryteLn "module Main where"
  wryteLn ""
  wryteLn "main = do"
  indented $ do
    wryteLn "putStrLn \"Hello, world!\"

Indentation is tracked monadically, such that indented acts as a wrapper that automatically prepends indentation to each new line. Indentations stack up, so you can safely nest them, and they will do the right thing.