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

Nixfmt.Util

Synopsis

Documentation

manyP :: (Stream s, Ord e) => (Token s -> Bool) -> ParsecT e s m (Tokens s) Source #

Match zero or more characters that match a predicate.

someP :: (Stream s, Ord e) => (Token s -> Bool) -> ParsecT e s m (Tokens s) Source #

Match one or more characters that match a predicate.

manyText :: (Stream s, Ord e) => ParsecT e s m Text -> ParsecT e s m Text Source #

Match zero or more texts and return the concatenation.

someText :: (Stream s, Ord e) => ParsecT e s m Text -> ParsecT e s m Text Source #

Match one or more texts and return the concatenation.

commonPrefix :: Text -> Text -> Text Source #

The longest common prefix of the arguments.

commonIndentation :: [Text] -> Maybe Text Source #

The longest common prefix consisting of only whitespace. The longest common prefix of zero texts is infinite, represented as Nothing.

dropCommonIndentation :: [Text] -> [Text] Source #

Strip the longest common indentation from a list of lines. Empty lines do not count towards the common indentation.

replaceMultiple :: [(Text, Text)] -> Text -> Text Source #

Apply multiple independent replacements. This function passes over the text once and applies the first replacement it can find at each position. After a replacement is matched, the function continues after the replacement, not inside it.