dhall-1.41.2: A configuration language guaranteed to terminate
Safe HaskellNone
LanguageHaskell2010

Dhall.Util

Description

Shared utility functions

Synopsis

Documentation

snip :: Text -> Text Source #

Utility function to cut out the interior of a large text block

snipDoc :: Doc Ann -> Doc a Source #

Like snip, but for Docs

Note that this has to be opinionated and render ANSI color codes, but that should be fine because we don't use this in a non-interactive context

insert :: Pretty a => a -> Doc Ann Source #

Function to insert an aligned pretty expression

_ERROR :: IsString string => string Source #

Prefix used for error messages

data Censor Source #

Set to Censor if you want to censor error text that might include secrets

Constructors

NoCensor 
Censor 

data Input Source #

Path to input

Instances

Instances details
Eq Input Source # 
Instance details

Defined in Dhall.Util

Methods

(==) :: Input -> Input -> Bool #

(/=) :: Input -> Input -> Bool #

data Transitivity Source #

Specifies whether or not an input's transitive dependencies should also be processed. Transitive dependencies are restricted to relative file imports.

Constructors

NonTransitive

Do not process transitive dependencies

Transitive

Process transitive dependencies in the same way

data OutputMode Source #

Some command-line subcommands can either Write their input or Check that the input has already been modified. This type is shared between them to record that choice.

Constructors

Write 
Check 

data Output Source #

Path to output

getExpression :: Censor -> Input -> IO (Expr Src Import) Source #

Convenient utility for retrieving an expression

getExpressionAndHeader :: Censor -> Input -> IO (Header, Expr Src Import) Source #

Convenient utility for retrieving an expression along with its header

getExpressionAndHeaderFromStdinText :: Censor -> String -> Text -> IO (Header, Expr Src Import) Source #

Convenient utility for retrieving an expression along with its header from | text already read from STDIN (so it's not re-read)

newtype Header Source #

A header corresponds to the leading comment at the top of a Dhall file.

The header includes comment characters but is stripped of leading spaces and trailing newlines

Constructors

Header Text 

Instances

Instances details
Show Header Source # 
Instance details

Defined in Dhall.Parser

newtype CheckFailed Source #

A check failure corresponding to a single input. This type is intended to be used with MultipleCheckFailed for error reporting.

Constructors

CheckFailed 

Fields

data MultipleCheckFailed Source #

Exception thrown when the --check flag to a command-line subcommand fails

handleMultipleChecksFailed :: (Foldable t, Traversable t) => Text -> Text -> (a -> IO (Either CheckFailed ())) -> t a -> IO () Source #

Run IO for multiple inputs, then collate all the check failures before throwing if there was any failure

renderExpression :: Pretty a => CharacterSet -> Bool -> Maybe FilePath -> Expr Src a -> IO () Source #

Convenient utility to output an expression either to a file or to stdout.