hindent-4.3.1: Extensible Haskell pretty printer

Safe HaskellNone
LanguageHaskell98

HIndent.Types

Description

All types.

Synopsis

Documentation

newtype Printer s a Source

A pretty printing monad.

Constructors

Printer 

Fields

runPrinter :: State (PrintState s) a
 

data PrintState s Source

The state of the pretty printer.

Constructors

PrintState 

Fields

psIndentLevel :: !Int64

Current indentation level.

psOutput :: !Builder

The current output.

psNewline :: !Bool

Just outputted a newline?

psColumn :: !Int64

Current column.

psLine :: !Int64

Current line number.

psUserState :: !s

User state.

psExtenders :: ![Extender s]

Extenders.

psConfig :: !Config

Config which styles may or may not pay attention to.

psEolComment :: !Bool

An end of line comment has just been outputted.

psInsideCase :: !Bool

Whether we're in a case statement, used for Rhs printing.

Instances

data Extender s where Source

A printer extender. Takes as argument the user state that the printer was run with, and the current node to print. Use prettyNoExt to fallback to the built-in printer.

Constructors

Extender :: forall s a. Typeable a => (a -> Printer s ()) -> Extender s 
CatchAll :: forall s. (forall a. Typeable a => s -> a -> Maybe (Printer s ())) -> Extender s 

data Style Source

A printer style.

Constructors

forall s . Style 

Fields

styleName :: !Text

Name of the style, used in the commandline interface.

styleAuthor :: !Text

Author of the printer (as opposed to the author of the style).

styleDescription :: !Text

Description of the style.

styleInitialState :: !s

User state, if needed.

styleExtenders :: ![Extender s]

Extenders to the printer.

styleDefConfig :: !Config

Default config to use for this style.

data Config Source

Configurations shared among the different styles. Styles may pay attention to or completely disregard this configuration.

Constructors

Config 

Fields

configMaxColumns :: !Int64

Maximum columns to fit code into ideally.

configIndentSpaces :: !Int64

How many spaces to indent?

configClearEmptyLines :: !Bool

Remove spaces on lines that are otherwise empty?

Instances

defaultConfig :: Config Source

Default style configuration.

data NodeInfo Source

Information for each node in the AST.

Constructors

NodeInfo 

Fields

nodeInfoSpan :: !SrcSpanInfo

Location info from the parser.

nodeInfoComments :: ![ComInfo]

Comments which are attached to this node.

data ComInfo Source

Comment with some more info.

Constructors

ComInfo 

Fields

comInfoComment :: !Comment

The normal comment type.

comInfoLocation :: !(Maybe ComInfoLocation)

Where the comment lies relative to the node.