Restrictioncore-field-selection
In a field selection (Appendix A), is a , a record, a record update, a field selection, or a phrase that begins with (: a parenthesised expression, a tuple, the unit or an operator value. A field accessor is never followed by a field selection: in the second . begins a second field accessor, so the phrase is the application of to . Likewise "s".x is the application of a string constant to the field accessor .x.
Tests (5)
- elm / CovForeignTypesTestChecks the use of two values from another module of the same project: `secretValue`, whose annotation names a type alias that its module does not expose, and a field of `config`, read through the module name as `CovForeignTypesHelper.config.x`. Their sum, 42, is logged.
- elm / DeepNestStressTestDeeply nested lists, tuples, records and `let` expressions can be built and taken apart.
- elm / EmbeddedMixedConstantsTestA record holding `Nothing`, `[]`, `True`, `""` and `()` returns each value unchanged when its field is read.
- elm / EmbeddedNothingInRecordTestA `Nothing` stored in a record field and read back with `.value` matches the `Nothing` pattern.
- elm / RecordNestedAccessTestChained field access reads through nested record literals two and three levels deep.
Discussions
Discuss this restriction·Search the discussions on GitHub
Discussions are on GitHub; one about this restriction has [res:core-field-selection] in its title.
A Standard Definition of Elm? (Draft version 0.4) © Rupert Smith. The text is licensed under CC BY 4.0: share and adapt it freely, with credit and a link to the licence.