Rule 104d-atpat-record
Atomic Patterns
(104)
Referred to from
- The comment on rule
d-atpat-unit(Chapter 6) - The comment on rule
d-patrow-field(Chapter 6)
TeX source
\defnrule[r:d-atpat-record]
{v=r\premsep\opt{\jdgv{E}{r}{\patrow}{\VE}}}
{\jdgv{E}{v}{\kw{\kwlb}\ \opt{\patrow}\ \kw{\kwrb}}{\emptymap\opt{+\,\VE}}}Tests (33)
- elm / CovLambdaSetFunctionsDestructuredFromTuplesAndRecordsTestLambdas taken out of a tuple and a record by destructuring `let` patterns, put in a list and applied in turn.
- elm / EdgeCaseAllDestructPatternsTest`let` bindings destructure a tuple, a record, a tuple returned by a `case`, and an `as` pattern, and each bound name has the expected value.
- elm / LambdaPatternArgTestChecks anonymous functions whose parameters are tuple, record and wildcard patterns.
- elm / LetDestructRecordTestRecord patterns in `let` bindings: a single field, two fields, a subset of a record's fields (`{ p, r }` from a record that also has `q`), and a record pattern nested inside a tuple pattern.
- elm / LssGapRecordFnNoAliasA function stored in a field of an unaliased record type is called through that field.
- elm / MinimalRecordPatternTestA record pattern binds the field it names.
- elm / RecordAccessTestDot syntax reads fields of let-bound record literals.
- elm / RecordAccessorFunctionCaseTestA record accessor function `.x` stored in a top-level value can be applied to a record.
- elm / RecordAccessorFunctionTestRecord accessor functions such as `.name` work as arguments to a function.
- elm / RecordNarrow01CapturesNonEmptyTestA let-bound helper with an inferred extensible-record argument, folded over two records with `List.foldl`, reads the right nested field when its `captures` field is a non-empty list.
- elm / RecordNarrow02CapturesNothingTestA let-bound helper with an inferred extensible-record argument, folded over two records with `List.foldl`, reads the right nested field when its `captures` field is `Nothing`.
- elm / RecordNarrow04SingleFieldTestA let-bound helper that reads a single field of a nested five-field record, folded with `List.foldl`, gets that field's value.
- elm / RecordNarrow05NoNestingTestA let-bound helper with an inferred extensible-record argument, folded with `List.foldl`, reads the right field of a record that is not nested in another.
- elm / RecordNarrow08NoDestructureTestA let-bound helper with an inferred extensible-record argument, folded with `List.foldl`, logs a nested custom-type field as `LambdaId 999`.
- elm / RecordNarrow09DirectCallTestA let-bound helper with an inferred extensible-record argument reads the right nested field when called directly.
- elm / RecordNarrow10TripleNestingTestA let-bound helper with an inferred extensible-record argument, folded with `List.foldl`, reads a field three records deep.
- elm / RecordNestedAccessTestChained field access reads through nested record literals two and three levels deep.
- elm / RecordOpenNarrowFieldIndexTestA let-bound helper with an inferred extensible-record argument, folded over two nested records with `List.foldl`, reads the right nested field.
- elm / StandardA99RecordPatternAsTestA record pattern under `as` in a `let` binding.
- elm / StandardA99RecordPatternBothTestA variable bound by a record pattern in a `let`, used at Int and at Float.
- elm / StandardA99RecordPatternDependentTestA `let` definition that uses a variable bound by a record pattern.
- elm / StandardA99RecordPatternFloatTestA variable bound by a record pattern in a `let`, used at Float.
- elm / StandardA99RecordPatternFunctionTestA function bound by a record pattern in a `let`, applied at Int and at Float.
- elm / StandardA99RecordPatternInTopCopyTestA record pattern in a `let` inside a top-level value that is itself copied.
- elm / StandardA99RecordPatternInTupleTestA record pattern inside the tuple pattern of a `let` binding.
- elm / StandardA99RecordPatternIntTestA variable bound by a record pattern in a `let`, used at Int.
- elm / StandardA99RecordPatternLambdaTestA record pattern in a lambda inside a `let` binding that is copied.
- elm / StandardA99RecordPatternSharedVariableTestTwo variables of one record pattern that share one `number` type.
- elm / StandardA99RecordPatternTwoVariablesTestTwo variables of one record pattern, with independent `number` types, used at opposite types.
- elm / StandardCoreEvaluationExamplesTestSmall programs for rules of the dynamic semantics of the Core that other tests reach only in passing, and examples from the Comments of A Standard Definition of Elm?, Chapter 6.
- elm / WideRecord33TestA record with 33 fields, cycling through `Int`, `Float`, `Char`, `String` and `Bool`, supports field access, record patterns, update, equality and printing.
- elm / WideRecord40TestA record with 40 fields, cycling through `Int`, `Float`, `Char`, `String` and `Bool`, supports field access, record patterns, update, equality and printing.
- elm / WideRecordPatternTestA record with 28 `Int` fields reads back correctly through field access, through a record pattern, and after a record update.
Discussions
Discuss this rule·Search the discussions on GitHub
Discussions are on GitHub; one about this rule has [r:d-atpat-record] 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.