Elm Exactly

Rule 168e-dec-value

DecodingDecτ(j)=v\Dec{\tau}(j)=v
j∈JValDecValue(j)=j\frac{\begin{array}{c}j\in\JVal\end{array}}{\begin{array}{c}\Dec{\tValue}(j)=j\end{array}}
(168)
Read it in its chapter·Permanent address: /standard/rules/e-dec-value

Comments

Every JSON value decodes at Json.Encode.Value. A boundary value in which a byte sequence occurs is not a JSON value, and does not decode there: it is rejected.

TeX source
\defnrule[r:e-dec-value]
  {j\in\JVal}
  {\Dec{\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-dec-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.