hindent-5.3.2: Extensible Haskell pretty printer
Safe HaskellSafe-Inferred
LanguageHaskell2010

HIndent.CodeBlock

Synopsis

Documentation

data CodeBlock Source #

A block of code.

Constructors

Shebang ByteString 
HaskellSource Int ByteString

Includes the starting line (indexed from 0) for error reporting

CPPDirectives ByteString 

Instances

Instances details
Eq CodeBlock Source # 
Instance details

Defined in HIndent.CodeBlock

Show CodeBlock Source # 
Instance details

Defined in HIndent.CodeBlock

cppSplitBlocks :: ByteString -> [CodeBlock] Source #

Break a Haskell code string into chunks, using CPP as a delimiter. Lines that start with 'end', or '#else' are their own chunks, and also act as chunk separators. For example, the code

#ifdef X
x = X
y = Y
#else
x = Y
y = X
#endif

will become five blocks, one for each CPP line and one for each pair of declarations.