hindent-4.3.5: 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 :: Decl NodeInfo -> Printer s () Source

Pretty print type signatures like

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

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

I want field updates to be dependent or newline.

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

Right-hand sides are dependent.

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

Right-hand sides are dependent.

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

Unguarded case alts.

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

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

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

I want guarded RHS be dependent or newline.

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

I want guarded alts be dependent or newline.

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

Expressions

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

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

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

Render multi-line nodes.

sandboxNonOverflowing :: Pretty ast => [ast NodeInfo] -> Printer t ((Bool, Bool), PrintState t) 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 t (Bool, PrintState t) Source

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

isSmall :: MonadState (PrintState t) m => m a -> m (Bool, PrintState t) 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 t a -> Printer t Bool Source

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

isOverflowMax :: Printer t a -> Printer t Bool Source

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

isSingleLiner :: MonadState (PrintState t) 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 t () Source

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

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