hindent-4.6.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 :: 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.

isSmallFitting :: MonadState (PrintState t) m => m a -> m (Bool, PrintState t) Source #

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

isFlat :: Exp NodeInfo -> Bool Source #

Is an expression flat?

fitsOnOneLine :: MonadState (PrintState s) m => m a -> m (Bool, PrintState s) Source #

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

fitsInColumnLimit :: Printer t a -> Printer t (Bool, PrintState t) Source #

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

data OpChainLink l Source #

A link in a chain of operator applications.

Constructors

OpChainExp (Exp l) 
OpChainLink (QOp l) 

flattenOpChain :: Exp l -> [OpChainLink l] Source #

Flatten a tree of InfixApp expressions into a chain of operator links.

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.