Elm Exactly

Rule 70d-atexp-tuple

Atomic ExpressionsE⊢atexp⇒v\jdg{E}{\atexp}{v}
E⊢exp1⇒v1E⊢exp2⇒v2⟨E⊢exp3⇒v3⟩E⊢(exp1, exp2 ⟨, exp3⟩)⇒(v1,v2⟨,v3⟩)\frac{\begin{array}{c}\jdg{E}{\expm_1}{v_1}\premsep\jdg{E}{\expm_2}{v_2}\premsep \opt{\jdg{E}{\expm_3}{v_3}}\end{array}}{\begin{array}{c}\jdg{E}{\kw{(}\expm_1\kw{,}\ \expm_2\ \opt{\kw{,}\ \expm_3}\kw{)}} {(v_1,v_2\opt{,v_3})}\end{array}}
(70)
Read it in its chapter·Permanent address: /standard/rules/d-atexp-tuple
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 / CharAstralTupleTest
    An 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 / CovLambdaSetFunctionsInRecordsTuplesAndMaybeTest
    Functions stored in record fields, tuples and a `Maybe`, taken out again and applied.
  • elm / DebugLogRecordTupleFieldTest
    A `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 / HigherOrderFunctionFactoryTest
    A let-bound function that returns a lambda capturing its argument produces a working function.
  • elm / ListLiteralDebugLogKindTest
    Values returned by `Debug.log` keep their value when used in a closure, a tuple, a function argument, a list literal and a `::` cons.
  • elm / TupleCharFieldTest
    A tuple holding a `Char` and an `Int` (`( 'A', Char.toCode 'A' )`) is built and printed with both components intact.
  • elm / TuplePairTest
    Tuple literals of `Int`, `String` and `Bool` components are built and printed correctly.
  • elm / TupleTripleTest
    Checks 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.