hindent-4.2.2: Extensible Haskell pretty printer

Safe HaskellNone
LanguageHaskell98

HIndent.Styles.ChrisDone

Description

Chris Done's style.

Documented here: https://github.com/chrisdone/haskell-style-guide

Synopsis

Documentation

shortName :: Int64 Source

A short function name.

smallColumnLimit :: Int64 Source

Column limit: 50

data State Source

Empty state.

Constructors

State 

chrisDone :: Style Source

The printer style.

decl :: t -> Decl NodeInfo -> Printer () Source

Pretty print type signatures like

foo :: (Show x,Read x) => (Foo -> Bar) -> Maybe Int -> (Char -> X -> Y) -> IO ()

fieldupdate :: t -> FieldUpdate NodeInfo -> Printer () Source

I want field updates to be dependent or newline.

rhs :: s -> Rhs NodeInfo -> Printer () Source

Right-hand sides are dependent.

unguardedrhs :: s -> Rhs NodeInfo -> Printer () Source

Right-hand sides are dependent.

unguardedalt :: t -> Rhs NodeInfo -> Printer () Source

Unguarded case alts.

contextualGuardedRhs :: s -> GuardedRhs NodeInfo -> Printer () Source

Decide whether to do alts or rhs based on the context.

guardedrhs :: s -> GuardedRhs NodeInfo -> Printer () Source

I want guarded RHS be dependent or newline.

guardedalt :: s -> GuardedRhs NodeInfo -> Printer () Source

I want guarded alts be dependent or newline.

exp :: s -> Exp NodeInfo -> Printer () Source

Expressions

sandboxSingles :: Pretty ast => [ast NodeInfo] -> Printer (Bool, PrintState) Source

Sandbox and render the nodes on multiple lines, returning whether each is a single line.

multi :: Pretty ast => Int64 -> [ast NodeInfo] -> Bool -> Printer () Source

Render multi-line nodes.

sandboxNonOverflowing :: Pretty ast => [ast NodeInfo] -> Printer ((Bool, Bool), PrintState) Source

Sandbox and render the node on a single line, return whether it's on a single line and whether it's overflowing.

isShort :: Pretty ast => ast NodeInfo -> Printer (Bool, PrintState) Source

Is the expression "short"? Used for app heads.

isSmall :: MonadState PrintState m => m a -> m (Bool, PrintState) Source

Is the given expression "small"? I.e. does it fit on one line and under smallColumnLimit columns.

isFlat :: Exp NodeInfo -> Bool Source

Is an expression flat?

isOverflow :: Printer a -> Printer Bool Source

Does printing the given thing overflow column limit? (e.g. 80)

isOverflowMax :: Printer a -> Printer Bool Source

Does printing the given thing overflow column limit? (e.g. 80)

isSingleLiner :: MonadState PrintState m => m a -> m Bool Source

Is the given expression a single-liner when printed?

infixApp :: (Pretty ast, Pretty ast1, Pretty ast2) => Exp NodeInfo -> ast NodeInfo -> ast1 NodeInfo -> ast2 NodeInfo -> Maybe Int64 -> Printer () Source

dependOrNewline :: Printer () -> Exp NodeInfo -> (Exp NodeInfo -> Printer ()) -> Printer () Source

Make the right hand side dependent if it's flat, otherwise newline it.