Simple Types
Hamler is strongly typed, and has a powerful static type system. Let’s start with some simple examples.
Boolean
true :: Boolean
false :: Boolean
Numbers
Hamler has Integer and Float, and since they have different types so they can’t be mixed.
--Integer
1 :: Integer
--Float
0.1 :: Float
Atoms
Atom is probably more familiar to Erlang user. It is a literal, a constant with a name starting with :
.
:hello
:world
Strings
In Hamler String
is just a list of Char
"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,2,3:8,4:16,5,"abcdefg">> :: Binary
当前内容版权归 hamler-lang 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 hamler-lang .