language-thrift-0.9.0.1: Parser and pretty printer for the Thrift IDL format.

Copyright(c) Abhinav Gupta 2016
LicenseBSD3
MaintainerAbhinav Gupta <mail@abhinavg.net>
Stabilityexperimental
Safe HaskellSafe
LanguageHaskell2010

Language.Thrift.Pretty

Contents

Description

This module provides a pretty printer for Thrift IDLs. Most of the printers defined in this module produce output highlighted using ANSI escape codes. Get plain output by using plain.

Use prettyPrintHighlighted to produce output highlighted using ANSI escape codes. Note that this output will be unparseable and is suitable for printing inside a compatible terminal only. Use prettyPrint if you don't want highlighted output.

The behavior of the printer can be customized using Config objects.

The module also exports instances of the Pretty typeclass for elements of the AST.

Synopsis

Documentation

prettyPrintHighlighted :: Program ann -> Doc Source

Top-level pretty printer for Thrift documents.

prettyPrint :: Program ann -> Doc Source

Top-level pretty printer for Thrift documents that uses the default configuration (defaultConfig) for pretty printing.

Components

program :: Config -> Program ann -> Doc Source

Pretty print a Thrift IDL.

header :: Header ann -> Doc Source

Print the headers for a program.

definition :: Config -> Definition ann -> Doc Source

Print a constant, type, or service definition.

enum :: Config -> Enum ann -> Doc Source

union :: Config -> Union ann -> Doc Source

senum :: Config -> Senum ann -> Doc Source

typeReference :: Config -> TypeReference ann -> Doc Source

Pretty print a field type.

constantValue :: Config -> ConstValue ann -> Doc Source

Pretty print a constant value.

Configuration

data Config Source

Configuration for the pretty printer.

Constructors

Config 

Fields

indentWidth :: Int

Number of spaces to use for indentation.

defaultConfig :: Config Source

Default pretty printing configuration.