nixfmt-0.5.0: An opinionated formatter for Nix
Safe HaskellSafe-Inferred
LanguageHaskell2010

Nixfmt.Predoc

Description

This module implements a layer around the prettyprinter package, making it easier to use.

Synopsis

Documentation

sepBy :: Pretty a => Doc -> [a] -> Doc Source #

hcat :: Pretty a => [a] -> Doc Source #

Concatenate documents horizontally without spacing.

group :: Pretty a => a -> Doc Source #

nest :: Int -> Doc -> Doc Source #

nest n doc sets the indentation for lines in doc to n more than the indentation of the part before it. This is based on the actual indentation of the line, rather than the indentation it should have used: If multiple indentation levels start on the same line, only the last indentation level will be applied on the next line. This prevents unnecessary nesting.

type Doc = [DocE] Source #

class Pretty a Source #

Minimal complete definition

pretty

Instances

Instances details
Pretty String Source # 
Instance details

Defined in Nixfmt.Predoc

Methods

pretty :: String -> Doc Source #

Pretty Text Source # 
Instance details

Defined in Nixfmt.Predoc

Methods

pretty :: Text -> Doc Source #

Pretty Doc Source # 
Instance details

Defined in Nixfmt.Predoc

Methods

pretty :: Doc -> Doc Source #

Pretty Token Source # 
Instance details

Defined in Nixfmt.Pretty

Methods

pretty :: Token -> Doc Source #

Pretty File Source # 
Instance details

Defined in Nixfmt.Pretty

Methods

pretty :: File -> Doc Source #

Pretty Expression Source # 
Instance details

Defined in Nixfmt.Pretty

Pretty Parameter Source # 
Instance details

Defined in Nixfmt.Pretty

Methods

pretty :: Parameter -> Doc Source #

Pretty ParamAttr Source # 
Instance details

Defined in Nixfmt.Pretty

Methods

pretty :: ParamAttr -> Doc Source #

Pretty Term Source # 
Instance details

Defined in Nixfmt.Pretty

Methods

pretty :: Term -> Doc Source #

Pretty Binder Source # 
Instance details

Defined in Nixfmt.Pretty

Methods

pretty :: Binder -> Doc Source #

Pretty Selector Source # 
Instance details

Defined in Nixfmt.Pretty

Methods

pretty :: Selector -> Doc Source #

Pretty SimpleSelector Source # 
Instance details

Defined in Nixfmt.Pretty

Pretty StringPart Source # 
Instance details

Defined in Nixfmt.Pretty

Pretty TrailingComment Source # 
Instance details

Defined in Nixfmt.Pretty

Pretty Trivium Source # 
Instance details

Defined in Nixfmt.Pretty

Methods

pretty :: Trivium -> Doc Source #

Pretty [[StringPart]] Source # 
Instance details

Defined in Nixfmt.Pretty

Methods

pretty :: [[StringPart]] -> Doc Source #

Pretty [Token] Source # 
Instance details

Defined in Nixfmt.Pretty

Methods

pretty :: [Token] -> Doc Source #

Pretty [StringPart] Source # 
Instance details

Defined in Nixfmt.Pretty

Methods

pretty :: [StringPart] -> Doc Source #

Pretty [Trivium] Source # 
Instance details

Defined in Nixfmt.Pretty

Methods

pretty :: [Trivium] -> Doc Source #

Pretty a => Pretty (Maybe a) Source # 
Instance details

Defined in Nixfmt.Predoc

Methods

pretty :: Maybe a -> Doc Source #

Pretty a => Pretty (Ann a) Source # 
Instance details

Defined in Nixfmt.Pretty

Methods

pretty :: Ann a -> Doc Source #

pretty :: Pretty a => a -> Doc Source #

fixup :: Doc -> Doc Source #

Fix up a Doc in multiple stages: - First, all spacings are moved out of Groups and Nests and empty Groups and Nests are removed. - Now, all consecutive Spacings are ensured to be in the same list, so each sequence of Spacings can be merged into a single one. - Finally, Spacings right before a Nest should be moved inside in order to get the right indentation.

layout :: Pretty a => Int -> a -> Text Source #

textWidth :: Text -> Int Source #

To support i18n, this function needs to be patched.