Closed Gabriella439 closed 11 months 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
.
This adds the following four new high-level entrypoints:
interpretExpr
interpretExprWithSettings
fromExpr
fromExprWithSettings
… as well as several new utilities for running each phase one at a time, respecting
InputSettings
:parseWithSettings
resolveWithSettings
typecheckWithSettings
expectWithSettings
normalizeWithSettings
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
Expr
s, 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