dhall-lang / dhall-haskell

Maintainable configuration files
https://dhall-lang.org/
BSD 3-Clause "New" or "Revised" License
912 stars 213 forks source link

Add several new entrypoints to `Dhall` module #2534

Closed Gabriella439 closed 11 months ago

Gabriella439 commented 1 year ago

This adds the following four new high-level entrypoints:

… as well as several new utilities for running each phase one at a time, respecting InputSettings:

This also refactors the other utilities to use those new phase-based settings.

The motivation behind this change is to make it easier for people to work with raw Exprs, so that people don't need to craft strings when trying to assemble ASTs to interpret like in this issue:

https://stackoverflow.com/questions/77037023/is-there-an-elegant-way-to-override-dhall-records-in-haskell

mmhat commented 1 year ago

@Gabriella439 I think it was nice if there was also a function checkWithSettings :: InputSettings -> Expr Src Void -> Expr Src Void -> m () that is something between expectWithSettings and typecheckWithSettings: A function that typechecks an input value against a type provided as an Expr. That way one does not need to construct an incomplete Decoder with extract = undefined.