Skip to content

v14.0.0

Compare
Choose a tag to compare
@Gabriella439 Gabriella439 released this 14 Feb 05:47
· 257 commits to master since this release
09b2043

Deprecation notice:

Breaking changes:

  • Disallow Natural literals with leading zeros

    Natural numbers can no longer start with a leading zero, for two main
    reasons:

    • So that users will not confuse them with octal numbers

    • So that implementations are less likely to inadvertently parse them as octal
      numbers

New features:

  • Add support for duplicate record fields

    Up until now, the Dhall interpreter would reject duplicate fields within
    records, such as:

    { x = { y = 1 }, x = { z = 1 } }

    However, several other configuration languages permit duplicate fields so
    long as (A) they are records and (B) their nested fields do not conflict
    (such as in the above example). Now the Dhall configuration language behaves
    that way, too.

    Specifically, the rules are that more than one occurrence of a field desugars
    to use of the operator to combine the duplicate occurrences. So, for
    example, the above expression is now syntactic sugar for:

    { a = { b = 1 }  { c = 1 } }

    ... which then further evaluates to:

    { a = { b = 1, c = 1 } }

    Other cases for duplicate fields are still rejected as type errors. For
    example, this expression:

    { a = 0, a = 0 }

    ... desugars to:

    { a = 0  0 }

    ... which is a type error.

    This feature combines well with the following feature for dotted field
    syntax.

  • Add support for dotted field syntax

    You can now compress deeply nested record hierarchies by chaining nested
    fields with dots.

    For example, the following record:

    { a.b.c = 1 }

    ... is syntactic sugar for nesting records like this:

    { a = { b = { c = 1 } } }

    You can combine this feature with the previous feature for duplicate
    fields. For example, the following record:

    { a.b.c = 1, a.b.d = True }

    ... desugars to:

    { a = { b = { c = 1 } }, a = { b = { d = True } } }

    ... and the duplicate fields merge to produce:

    { a = { b = { c = 1, d = True } } }
  • Fix typing rule for merging Optionals

    The previous released introduced merge support for Optional values, such
    as:

    merge { None = 0, Some = λ(n : Natural)  n } (Some 4)

    However, the final argument to merge was limited to Optional literals
    (e.g. Some or None), but did not work on abstract Optional values, such
    as bound variables. For example, the following example would fail to
    type-check:

    λ(o : Optional Natural)  merge { None = 0, Some = λ(n : Natural)  n } o

    This release fixes that and the above example is now valid Dhall code.