Elm Exactly

Rule 152e-enc-tuple

EncodingEncτ(v)=j\Enc{\tau}(v)=j
Encτ1(v1)=j1Encτ2(v2)=j2⟨Encτ3(v3)=j3⟩k=2⟨+1⟩Enc(τ1,τ2⟨,τ3⟩) Tuplek((v1,v2⟨,v3⟩))=[j1,j2⟨,j3⟩]\frac{\begin{array}{c}\Enc{\tau_1}(v_1)=j_1\premsep\Enc{\tau_2}(v_2)=j_2\premsep \opt{\Enc{\tau_3}(v_3)=j_3}\premsep k=2\opt{{}+1}\end{array}}{\begin{array}{c}\Enc{(\tau_1,\tau_2\opt{,\tau_3})\,\tTuple{k}}((v_1,v_2\opt{,v_3})) =\effJarr{j_1,j_2\opt{,j_3}}\end{array}}
(152)
Read it in its chapter·Permanent address: /standard/rules/e-enc-tuple
TeX source
\defnrule[r:e-enc-tuple]
  {\Enc{\tau_1}(v_1)=j_1\premsep\Enc{\tau_2}(v_2)=j_2\premsep
   \opt{\Enc{\tau_3}(v_3)=j_3}\premsep k=2\opt{{}+1}}
  {\Enc{(\tau_1,\tau_2\opt{,\tau_3})\,\tTuple{k}}((v_1,v_2\opt{,v_3}))
   =\effJarr{j_1,j_2\opt{,j_3}}}

Tests (8)

  • elm / MinimalPipeTupleTest
    A pipe at `( Int, Int )`: the value the driver sends in comes back out.
  • elm / PortEchoNestedTest
    A `List (Maybe ( Int, List String ))` sent out through a port comes back unchanged through an incoming port, for each of two sample values.
  • elm / PortEchoTuple2Test
    A `( Int, String )` sent out through an outgoing port comes back unchanged through an incoming port.
  • elm / PortEchoTuple3Test
    A `( Int, Float, Bool )` sent out through an outgoing port comes back unchanged through an incoming port.
  • elm / PortPipeBytesRejectTest
    A JSON value sent to a `Bytes` port is rejected, whatever it holds.
  • elm / PortPipeRejectTest
    Values that do not decode at an incoming port's type are rejected, and the program goes on.
  • elm / PortPipeTupleTest
    A JSON array received at a tuple type goes out with as many elements as the tuple has.
  • elm / PortPipeValueRejectsBytesTest
    A byte sequence sent to a `Json.Encode.Value` port is rejected, alone or inside an object.

Discussions

Discuss this rule·Search the discussions on GitHub

Discussions are on GitHub; one about this rule has [r:e-enc-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.