HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduledhall-1.42.3Haskell2010

Dhall

Please read the Dhall.Tutorial module, which contains a tutorial explaining how to use the language, the compiler, and this library

  • 2 types
  • 1 class
  • 27 values
  • Packagedhall-1.42.3
  • Exports30
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceDhall.hs

Input

22 declarations
valueinput
  1. :: Decoder a

    The decoder for the Dhall value

  2. -> Text

    The Dhall program

  3. -> IO a

    The decoded value in Haskell

#

Type-check and evaluate a Dhall program, decoding the result into Haskell

The first argument determines the type of value that you decode:

Example2 expressions
input integer "+2"2input (vector double) "[1.0, 2.0]"[1.0,2.0]

Use auto to automatically select which type to decode based on the inferred return type:

Example1 expression
input auto "True" :: IO BoolTrue

This uses the settings from defaultInputSettings.

valueinputWithSettings
  1. :: InputSettings
  2. -> Decoder a

    The decoder for the Dhall value

  3. -> Text

    The Dhall program

  4. -> IO a

    The decoded value in Haskell

#

Extend input with a root directory to resolve imports relative to, a file to mention in errors as the source, a custom typing context, and a custom normalization process.

valueinputFile
  1. :: Decoder a

    The decoder for the Dhall value

  2. -> FilePath

    The path to the Dhall program.

  3. -> IO a

    The decoded value in Haskell.

#

Type-check and evaluate a Dhall program that is read from the file-system.

This uses the settings from defaultEvaluateSettings.

Access the name of the source to report locations from; this is only used in error messages, so it's okay if this is a best guess or something symbolic.

valuedetailed :: IO a -> IO a
#

Use this to provide more detailed error messages

> input auto "True" :: IO Integer
 *** Exception: Error: Expression doesn't match annotation

 True : Integer

 (input):1:1
> detailed (input auto "True") :: IO Integer
 *** Exception: Error: Expression doesn't match annotation

 Explanation: You can annotate an expression with its type or kind using the
 ❰:❱ symbol, like this:


     ┌───────┐
     │ x : t │  ❰x❱ is an expression and ❰t❱ is the annotated type or kind of ❰x❱
     └───────┘

 The type checker verifies that the expression's type or kind matches the
 provided annotation

 For example, all of the following are valid annotations that the type checker
 accepts:


     ┌─────────────┐
     │ 1 : Natural │  ❰1❱ is an expression that has type ❰Natural❱, so the type
     └─────────────┘  checker accepts the annotation


     ┌───────────────────────┐
     │ Natural/even 2 : Bool │  ❰Natural/even 2❱ has type ❰Bool❱, so the type
     └───────────────────────┘  checker accepts the annotation


     ┌────────────────────┐
     │ List : Type → Type │  ❰List❱ is an expression that has kind ❰Type → Type❱,
     └────────────────────┘  so the type checker accepts the annotation


     ┌──────────────────┐
     │ List Text : Type │  ❰List Text❱ is an expression that has kind ❰Type❱, so
     └──────────────────┘  the type checker accepts the annotation


 However, the following annotations are not valid and the type checker will
 reject them:


     ┌──────────┐
     │ 1 : Text │  The type checker rejects this because ❰1❱ does not have type
     └──────────┘  ❰Text❱


     ┌─────────────┐
     │ List : Type │  ❰List❱ does not have kind ❰Type❱
     └─────────────┘


 You or the interpreter annotated this expression:

 ↳ True

 ... with this type or kind:

 ↳ Integer

 ... but the inferred type or kind of the expression is actually:

 ↳ Bool

 Some common reasons why you might get this error:

 ● The Haskell Dhall interpreter implicitly inserts a top-level annotation
   matching the expected type

   For example, if you run the following Haskell code:


     ┌───────────────────────────────┐
     │ >>> input auto "1" :: IO Text │
     └───────────────────────────────┘


   ... then the interpreter will actually type check the following annotated
   expression:


     ┌──────────┐
     │ 1 : Text │
     └──────────┘


   ... and then type-checking will fail

 ────────────────────────────────────────────────────────────────────────────────

 True : Integer

 (input):1:1

Decoders

0 declarations

Encoders

0 declarations

Individual phases

7 declarations

Miscellaneous

1 declaration
valuerawInput
  1. :: Alternative f
  2. => Decoder a

    The decoder for the Dhall value

  3. -> Expr s Void

    a closed form Dhall program, which evaluates to the expected type

  4. -> f a

    The decoded value in Haskell

#

Use this function to extract Haskell values directly from Dhall AST. The intended use case is to allow easy extraction of Dhall values for making the function normalizeWith easier to use.

For other use cases, use input from Dhall module. It will give you a much better user experience.