Elm Exactly

Figureeffects-port-table

Figure 25, What Can and Cannot Be Sent over a Port, in Section 8.7 Ports.

Elm typePort?Sent as (Enc)Accepted (Dec)
Intyesthe numbera number that is an integer in IntRange\IntRange
Floatyesthe number; null\effnull for NaN and the infinitiesany number, rounded
Boolyestrue\efftrue or false\efffalsetrue\efftrue or false\efffalse only
Stringyesthe stringa string only
Bytesyesa byte sequencea byte sequence only
()yesnull\effnullnull\effnull only (flags: Chapter 9)
Maybe ty\tyif ty\ty isnull\effnull for Nothing; vv as ty\ty for Just vvnull\effnull as Nothing; anything else as ty\ty, under Just
List ty\tyif ty\ty isan arrayan array whose elements decode as ty\ty
Array ty\tyif ty\ty isan arrayan array whose elements decode as ty\ty
(ty1\ty_1, ty2\ty_2), (ty1\ty_1, ty2\ty_2, ty3\ty_3)if each tyi\ty_i isan array of 2 or 3 elementsan array at least as long; further elements ignored
closed record { lab1\lab_1 : ty1\ty_1, … }if each tyi\ty_i isan object with exactly the fields as keysan object with at least those keys; further keys ignored
Json.Encode.Valueyesitselfany JSON value; no byte sequence
Charno
a function typeno
a type variableno
an extensible recordno
any other custom type (Result, Order, Dict, Set, and those of the program)no
any other abstract type (Cmd, Sub, Task, Process.Id, Program)no
Figure 25: What Can and Cannot Be Sent over a Port
Read it in its chapter·Permanent address: /standard/figures/effects-port-table

Referred to from

Tests (0)

No test of the suite checks this figure yet.

Discussions

Discuss this figure·Search the discussions on GitHub

Discussions are on GitHub; one about this figure has [fig:effects-port-table] 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.