Deprecation of old Optional literal syntax
Migrate your code to remove obsolete
List-likeOptionalliterals
On August 31, 2018 the language standard changed to add new Some/None Optional literals to eventually replace the old List-like Optional literal syntax. This section describes what changed and how to migrate your code.
Changes
Before this change, the normal form of an Optional literal resembled a list with at most 1 element:
[ 1 ] : Optional Natural -- An example present `Optional` literal
[] : Optional Natural -- An example absent `Optional` literal
After this change, the normal form of an Optional literal is now either a Some or a None constructor:
Some 1 -- An example present `Optional` literal
None Natural -- An example absent `Optional` literal
Additionally, the old List-like Optional literals now normalize to their equivalent Some/None constructor. So, for example:
[ 1 ] : Optional Naturalwill normalize toSome 1[] : Optional Literalwill normalize toNone Natural.
Phases
The old Optional literal syntax will be phased out in two steps:
Phase 1 - Add new
Some/NoneconstructorsThe first phase is backwards compatible. The only difference is that the normal form of expressions with
Optionalliterals changes to use the more compactSome/Noneconstructors.Phase 2 - Remove the old
List-likeOptionalliteralsThis change is strongly backwards incompatible by removing support for the old
List-like syntax forOptionalliterals, breaking all code that still uses the old syntax.
Migration
Phase 1 - Automatically migrate your code
During this phase
dhall lintwill automatically migrate the oldList-like syntax to useSome/Noneinstead to ease the migration process. This is a safe and behavior-preserving transformation.Phase 2 - Your code breaks if you haven’t migrated
During Phase 2 the deprecation cycle is complete and if you haven’t migrated then your code will fail to type-check since all list-like literals will be treated as
Lists and notOptionals.