The wryte package

[ Tags: bsd3, library, web ] [ Propose Tags ]

Wryte provides a convenient API for semi-automatically indented source code output.


[Skip to Readme]

Properties

Versions 0.1.0.0, 0.1.1.0, 0.2.0.0
Dependencies base (>=4.7 && <5), mtl, text [details]
License BSD3
Copyright 2017 Tobias Dammers
Author Tobias Dammers
Maintainer tdammers@gmail.com
Category Web
Home page https://github.com/tdammers/wryte#readme
Source repository head: git clone https://github.com/tdammers/wryte
Uploaded Sat May 27 09:22:49 UTC 2017 by TobiasDammers
Distributions NixOS:0.2.0.0
Downloads 147 total (14 in the last 30 days)
Rating 0.0 (0 ratings) [clear rating]
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2017-05-27 [all 1 reports]
Hackage Matrix CI

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for wryte-0.2.0.0

[back to package description]

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.