Elm Exactly

Figurestatic-modules-port-table

Figure 18, What can and cannot be sent over a port, in Section 5.4 Port Types.

TypePort?Reason
Int, Float, String, BoolyesJSON numbers, strings and Booleans
Bytesyesbyte sequences, which are not JSON values
()yesJSON null
Json.Encode.Value, Json.Decode.Valueyesany JSON value, never a byte sequence
List tt, Array ttif tt isJSON arrays
Maybe ttif tt isnull or the value
2- and 3-tuplesif each component isJSON arrays
closed recordsif each field isJSON objects
Charnoexcluded in Standard Elm
function typesnono JSON representation
type variables, constrained ones includednono JSON representation
extensible recordsnounknown fields
custom types other than Bool and Maybe: Result, Order, Never, Dict, Set, and every custom type of a programnono canonical encoding
Cmd, Sub, Task, and other abstract types of the basisnono JSON representation
Figure 18: What can and cannot be sent over a port
Read it in its chapter·Permanent address: /standard/figures/static-modules-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:static-modules-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.