Rule 70d-atexp-tuple
Atomic Expressions
(70)
TeX source
\defnrule[r:d-atexp-tuple]
{\jdg{E}{\expm_1}{v_1}\premsep\jdg{E}{\expm_2}{v_2}\premsep
\opt{\jdg{E}{\expm_3}{v_3}}}
{\jdg{E}{\kw{(}\expm_1\kw{,}\ \expm_2\ \opt{\kw{,}\ \expm_3}\kw{)}}
{(v_1,v_2\opt{,v_3})}}Tests (8)
- elm / CharAstralTupleTestAn astral `Char` (code point above 0xFFFF) in a pair and in a 3-tuple keeps its code point when read back with a tuple pattern, in a function's argument and in a destructuring `let`. How `Debug.log` prints such tuples is checked by `CharAstralTupleShowTest`.
- elm / CovLambdaSetFunctionsInRecordsTuplesAndMaybeTestFunctions stored in record fields, tuples and a `Maybe`, taken out again and applied.
- elm / DebugLogRecordTupleFieldTestA `Debug.log` call can be used directly as an `Int` or `Float` component of a tuple or field of a record, and the value it returns is stored there.
- elm / HigherOrderFunctionFactoryTestA let-bound function that returns a lambda capturing its argument produces a working function.
- elm / ListLiteralDebugLogKindTestValues returned by `Debug.log` keep their value when used in a closure, a tuple, a function argument, a list literal and a `::` cons.
- elm / TupleCharFieldTestA tuple holding a `Char` and an `Int` (`( 'A', Char.toCode 'A' )`) is built and printed with both components intact.
- elm / TuplePairTestTuple literals of `Int`, `String` and `Bool` components are built and printed correctly.
- elm / TupleTripleTestChecks that 3-tuple literals of `Int`s and of `String`s are built and printed by `Debug.log` as `(1,2,3)` and `("a","b","c")`.
Discussions
Discuss this rule·Search the discussions on GitHub
Discussions are on GitHub; one about this rule has [r:d-atexp-tuple] 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.