dhall-1.19.1: A configuration language guaranteed to terminate

Safe Haskell | None
Language | Haskell2010

Dhall.TH

Contents

- Template Haskell

Description

This module provides `staticDhallExpression` which can be used to resolve all of an expression’s imports at compile time, allowing one to reference Dhall expressions from Haskell without having a runtime dependency on the location of Dhall files.

For example, given a file `"./Some/Type.dhall"` containing

    < This : Natural | Other : ../Other/Type.dhall >

... rather than duplicating the AST manually in a Haskell `Type`, you can do:

    Dhall.Type
    (\case
        UnionLit "This" _ _  -> ...
        UnionLit "Other" _ _ -> ...)
    $(staticDhallExpression "./Some/Type.dhall")

This would create the Dhall Expr AST from the `"./Some/Type.dhall"` file at compile time with all imports resolved, making it easy to keep your Dhall configs and Haskell interpreters in sync.

Synopsis

- staticDhallExpression :: Text -> Q Exp

# Template Haskell

staticDhallExpression :: Text -> Q Exp Source #

This fully resolves, type checks, and normalizes the expression, so the resulting AST is self-contained.