Elm Exactly

Rule 154e-enc-value

EncodingEncτ(v)=j\Enc{\tau}(v)=j
j∈JValEncValue(j)=j\frac{\begin{array}{c}j\in\JVal\end{array}}{\begin{array}{c}\Enc{\tValue}(j)=j\end{array}}
(154)
Read it in its chapter·Permanent address: /standard/rules/e-enc-value

Comments

A value of type Json.Encode.Value is already a JSON value and is sent as it is. The side condition j∈JValj\in\JVal holds of every value of that type, so no byte sequence is ever sent through Json.Encode.Value.

TeX source
\defnrule[r:e-enc-value]
  {j\in\JVal}
  {\Enc{\tValue}(j)=j}

Tests (4)

  • elm / MinimalPipeValueTest
    A pipe at `Value`: the value the driver sends in comes back out.
  • elm / PortEchoJsonValueTest
    JSON `Value`s received as flags are sent out through a port as they are, and come back through an incoming port decoded at a concrete type.
  • elm / PortPipeValueRejectsBytesTest
    A byte sequence sent to a `Json.Encode.Value` port is rejected, alone or inside an object.
  • elm / PortPipeValueTest
    A JSON value received at `Json.Encode.Value` goes out again as the same JSON value.

Discussions

Discuss this rule·Search the discussions on GitHub

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