Simple Types

Hamler is strongly typed, and has a powerful static type system. Let’s start with some simple examples.

Boolean

  1. true :: Boolean
  2. false :: Boolean

Numbers

Hamler has Integer and Float, and since they have different types so they can’t be mixed.

  1. --Integer
  2. 1 :: Integer
  3. --Float
  4. 0.1 :: Float

Atoms

Atom is probably more familiar to Erlang user. It is a literal, a constant with a name starting with : .

  1. :hello
  2. :world

Strings

In Hamler String is just a list of Char

  1. "Hello World" :: String -- ['H','e','l','l','o',',','W','o','r','l','d']

Binaries

This is the very unique datatype exists in Erlang, and notes for Haskell users Binary contains the same information as ByteString if you are not very familiar with binaries, this link should be helpful for some intuition.

  1. <<1,2,3:8,4:16,5,"abcdefg">> :: Binary