Deprecation of old Optional literal syntax
Migrate your code to remove obsolete
List
-likeOptional
literals
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 Natural
will normalize toSome 1
[] : Optional Literal
will normalize toNone Natural
.
Phases
The old Optional
literal syntax will be phased out in two steps:
Phase 1 - Add new
Some
/None
constructorsThe first phase is backwards compatible. The only difference is that the normal form of expressions with
Optional
literals changes to use the more compactSome
/None
constructors.Phase 2 - Remove the old
List
-likeOptional
literalsThis change is strongly backwards incompatible by removing support for the old
List
-like syntax forOptional
literals, breaking all code that still uses the old syntax.
Migration
Phase 1 - Automatically migrate your code
During this phase
dhall lint
will automatically migrate the oldList
-like syntax to useSome
/None
instead 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
List
s and notOptional
s.