54241f88c7
* Disable 1-field simplification by default This builds on top of #1315 to minimize disruption by disabling the breaking change by default and instead requiring the user to opt in by setting a new `collapseSingletonRecords` option to `True`. The additional tests added to verify this also caught a bug in the `Interpret` instance for functions, which this change also fixes. * Change to three-valued option ... based on feedback from @sjakobi This change the option to a three-valued option: * `Bare` - 1-field constructor does not include a nested record * `Wrapped` - 1-field constructor always includes a nested record * `Smart` - Named fields that don't begin with `_` include a nested record The default is `Wrapped` (for backwards compatibility), but users will probably want to eventually switch to `Smart` * Don't depend on `fieldModifier` for determining if a field is anonymous ... as suggested by @sjakobi
21 lines
593 B
Plaintext
21 lines
593 B
Plaintext
λ(Expr : Type)
|
|
→ let ExprF =
|
|
< LitF :
|
|
{ _1 : Natural }
|
|
| AddF :
|
|
{ _1 : Expr, _2 : Expr }
|
|
| MulF :
|
|
{ _1 : Expr, _2 : Expr }
|
|
>
|
|
|
|
in λ(Fix : ExprF → Expr)
|
|
→ let Lit = λ(x : Natural) → Fix (ExprF.LitF { _1 = x })
|
|
|
|
let Add =
|
|
λ(x : Expr) → λ(y : Expr) → Fix (ExprF.AddF { _1 = x, _2 = y })
|
|
|
|
let Mul =
|
|
λ(x : Expr) → λ(y : Expr) → Fix (ExprF.MulF { _1 = x, _2 = y })
|
|
|
|
in Add (Mul (Lit 3) (Lit 7)) (Add (Lit 1) (Lit 2))
|