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. (1, "a", true)
  2. (1, "a")
  3. (:error, "Reason")
  4. -- fst, snd
  5. fst (1, 'a') :: Integer -- 1
  6. snd (1, 'a') :: Char -- 'a'

Tuples in Erlang:

  1. {1, "a", true}
  2. {1, "a"}
  3. {error, "Reason"}