bricks-0.0.0.1: Bricks is a lazy functional language based on Nix.

Safe HaskellNone
LanguageHaskell2010

Bricks.IndentedString

Contents

Synopsis

Indented string

newtype InStr Source #

An "indented string literal," delimited by two single-quotes ''.

This type of literal is called "indented" because the parser automatically removes leading whitespace from the string (inStr'dedent), which makes it convenient to use these literals for multi-line strings within an indented expression without the whitespace from indentation ending up as part of the string.

Constructors

InStr 

inStr'join :: InStr -> Str'Dynamic Source #

Join InStrs with newlines interspersed.

inStr'level :: InStr -> Natural Source #

Determine how many characters of whitespace to strip from an indented string.

inStr'dedent :: InStr -> InStr Source #

Determine the minimum indentation of any nonempty line, and remove that many space characters from the front of every line.

inStr'trim :: InStr -> InStr Source #

Remove any empty lines from the beginning or end of an indented string.

Single line of an indented string

data InStr'1 Source #

One line of an InStr.

Constructors

InStr'1 

Fields

Instances

inStr'1'nonEmpty :: InStr'1 -> Bool Source #

Determines whether an InStr'1 contains any non-space characters. The opposite of inStr'1'nonEmpty.

This is used to determine whether this line should be considered when calculating the number of space characters to strip in inStr'dedent.

inStr'1'modifyLevel :: (Natural -> Natural) -> InStr'1 -> InStr'1 Source #

Modify an InStr by applying a function to its number of leading spaces.