language-thrift-0.11.0.0: 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 -> Struct ann -> Doc Source #

Deprecated: Use struct.

exception :: Config -> Struct ann -> Doc Source #

Deprecated: Use struct.

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

Instances
Eq Config Source # 
Instance details

Defined in Language.Thrift.Pretty

Methods

(==) :: Config -> Config -> Bool #

(/=) :: Config -> Config -> Bool #

Ord Config Source # 
Instance details

Defined in Language.Thrift.Pretty

Show Config Source # 
Instance details

Defined in Language.Thrift.Pretty

defaultConfig :: Config Source #

Default pretty printing configuration.

Orphan instances

Pretty FieldRequiredness Source # 
Instance details

Pretty TypeAnnotation Source # 
Instance details

Pretty (Program a) Source # 
Instance details

Methods

pretty :: Program a -> Doc #

prettyList :: [Program a] -> Doc #

Pretty (Header a) Source # 
Instance details

Methods

pretty :: Header a -> Doc #

prettyList :: [Header a] -> Doc #

Pretty (Include a) Source # 
Instance details

Methods

pretty :: Include a -> Doc #

prettyList :: [Include a] -> Doc #

Pretty (Namespace a) Source # 
Instance details

Methods

pretty :: Namespace a -> Doc #

prettyList :: [Namespace a] -> Doc #

Pretty (Definition a) Source # 
Instance details

Methods

pretty :: Definition a -> Doc #

prettyList :: [Definition a] -> Doc #

Pretty (Type a) Source # 
Instance details

Methods

pretty :: Type a -> Doc #

prettyList :: [Type a] -> Doc #

Pretty (Senum a) Source # 
Instance details

Methods

pretty :: Senum a -> Doc #

prettyList :: [Senum a] -> Doc #

Pretty (Struct a) Source # 
Instance details

Methods

pretty :: Struct a -> Doc #

prettyList :: [Struct a] -> Doc #

Pretty (Enum a) Source # 
Instance details

Methods

pretty :: Enum a -> Doc #

prettyList :: [Enum a] -> Doc #

Pretty (EnumDef a) Source # 
Instance details

Methods

pretty :: EnumDef a -> Doc #

prettyList :: [EnumDef a] -> Doc #

Pretty (Typedef a) Source # 
Instance details

Methods

pretty :: Typedef a -> Doc #

prettyList :: [Typedef a] -> Doc #

Pretty (Const a) Source # 
Instance details

Methods

pretty :: Const a -> Doc #

prettyList :: [Const a] -> Doc #

Pretty (Service a) Source # 
Instance details

Methods

pretty :: Service a -> Doc #

prettyList :: [Service a] -> Doc #

Pretty (Function a) Source # 
Instance details

Methods

pretty :: Function a -> Doc #

prettyList :: [Function a] -> Doc #

Pretty (Field a) Source # 
Instance details

Methods

pretty :: Field a -> Doc #

prettyList :: [Field a] -> Doc #

Pretty (TypeReference a) Source # 
Instance details

Pretty (ConstValue a) Source # 
Instance details

Methods

pretty :: ConstValue a -> Doc #

prettyList :: [ConstValue a] -> Doc #