hindent-4.6.0: Extensible Haskell pretty printer

Safe HaskellNone
LanguageHaskell98

HIndent.Styles.JohanTibell

Description

Stub module for Johan Tibell's style.

Documented here: https://github.com/tibbe/haskell-style-guide/blob/master/haskell-style.md

Questions:

How to indent after a guarded alt/rhs? How to indent let? How to indent large ADT constructors types?

Synopsis

Documentation

shortName :: Int64 Source #

A short function name.

data State Source #

Empty state.

Constructors

State 

johanTibell :: Style Source #

The printer style.

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

Make the right hand side dependent if it fits on one line, otherwise send it to the next line.

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

Handle do and case specially and also space out guards more.

guardedRhs :: GuardedRhs NodeInfo -> Printer s () Source #

Handle do specially.

Implement dangling right-hand-sides.

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

Space out tuples.

Expression customizations.

context :: Context NodeInfo -> Printer s () Source #

Format contexts with spaces and commas between class constraints.

unboxParens :: MonadState (PrintState s) m => m a -> m a Source #

decl :: Decl NodeInfo -> Printer s () Source #

Pretty print type signatures like

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

Specially format records. Indent where clauses only 2 spaces.

qualConDecl :: QualConDecl NodeInfo -> Printer s () Source #

Use special record display, used by dataDecl in a record scenario.

conDecl :: ConDecl NodeInfo -> Printer s () Source #

Fields are preceded with a space.

recDecl :: ConDecl NodeInfo -> Printer s () Source #

Record decls are formatted like: Foo { bar :: X }

isRecord :: QualConDecl t -> Bool Source #

Is the decl a record?

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

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

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

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

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

Is the given expression a single-liner when printed?

isShort :: Pretty ast => ast NodeInfo -> Printer s Bool Source #

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

isFlat :: Exp NodeInfo -> Printer s Bool Source #

Is an expression flat?

fieldupdate :: FieldUpdate NodeInfo -> Printer s () Source #

rhs on field update on the same line as lhs.

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