Tuples Mapping

Tuples Mapping

Tuples are defined as primitive data types in Hamler and compiled to Erlang tuples.

The differences from Erlang are as below:

  • Tuples in Hamler are enclosed within parentheses, while Tuples in Erlang are enclosed in braces.

  • The maximum length of Tuples in Hamler is 7, while there is no limit in Erlang.

Tuples in Hamler:

(1, "a", true)
(1, "a")
(:error, "Reason")

-- fst, snd
fst (1, 'a') :: Integer -- 1
snd (1, 'a') :: Char    -- 'a'

Tuples in Erlang:

{1, "a", true}
{1, "a"}

{error, "Reason"}