Rule 6s-atexp-tuple
Atomic Expressions
(6)
Comments
By the grammar is 2 or 3.
TeX source
\defnrule[r:s-atexp-tuple]
{\jdg{C}{\expm_i}{\tau_i} \quad (1 \le i \le k)}
{\jdg{C}{\kw{(}\,\expm_1\kw{,}\ \cdots\kw{,}\ \expm_k\,\kw{)}}{(\tau_1, \cdots, \tau_k)\tTuple{k}}}Tests (19)
- elm / BadTupleATupleOfFourTestA four-element tuple is rejected with a BAD TUPLE error.
- 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")`.
- elm / TypeMismatchAppendableAgainstATupleTestA list whose tuple elements disagree in both components is rejected with a TYPE MISMATCH.
- elm / TypeMismatchCompappendAgainstATupleTestA list whose two tuple entries disagree, one holding a value used with both `++` and `<`, the other a tuple of numbers in that position, is rejected with a TYPE MISMATCH.
- elm / TypeMismatchComparableAgainstATupleTestA list whose two tuple entries disagree, one holding a value used with `<`, the other a tuple of numbers in that position, is rejected with a TYPE MISMATCH.
- elm / TypeMismatchDifferentlyNamedComparableVarsTestA list of two tuples whose first components are values of different custom types is rejected with a TYPE MISMATCH, where the second components are functions annotated with differently named `comparable` variables.
- elm / TypeMismatchDifferentlyNamedFlexVarsTestA list of two tuples whose first components are values of different custom types is rejected with a TYPE MISMATCH, where the second components are functions annotated with differently named type variables.
- elm / TypeMismatchFlexibleRecordWhereClosedAfterAMismatchTestThe compiler rejects passing a tuple whose two components both disagree with the annotation, with a TYPE MISMATCH error.
- elm / TypeMismatchIntAgainstNumberAfterAMismatchTestThe compiler rejects a list of pairs whose second entry has a `String` first component where the first entry has a number, with a TYPE MISMATCH error.
- elm / TypeMismatchRigidExtensionWhereFlexibleAfterAMismatchTestAn extensible record argument placed in a list beside an unannotated local value is rejected with a TYPE MISMATCH.
- elm / TypeMismatchRigidNumberAsTupleTestReturning a tuple where the annotation promises a `number` is rejected with a TYPE MISMATCH.
- elm / TypeMismatchRigidVarAsTupleTestA function annotated `a -> a` that returns a tuple is rejected with a TYPE MISMATCH.
- elm / TypeMismatchTriplesDifferTestA triple whose third component does not match its annotation is rejected with a TYPE MISMATCH.
- elm / TypeMismatchTupleSizesDifferTestA triple given where the annotation promises a pair is rejected with a TYPE MISMATCH.
- elm / TypeMismatchTwoComparableVarsTestA list mixing tuples whose first components have different custom types is rejected with a TYPE MISMATCH.
- elm / TypeMismatchUnitsOnBothSidesTestA list of pairs whose second components differ, `( (), 1 )` and `( (), "a" )`, is rejected with a TYPE MISMATCH error.
- elm / TypeMismatchUnknownTypesOnBothSidesTestA list of pairs `( h, 1 )` and `( h, "a" )`, built inside a case on `[ 1, "a" ]`, is rejected with a TYPE MISMATCH error.
Discussions
Discuss this rule·Search the discussions on GitHub
Discussions are on GitHub; one about this rule has [r:s-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.