dhall-1.28.0: A configuration language guaranteed to terminate

Safe HaskellNone
LanguageHaskell2010

Dhall.TH

Contents

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

Template Haskell

staticDhallExpression :: Text -> Q Exp Source #

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