Sign inSign up

hamlerlang/hamler

By hamlerlang

•Updated almost 5 years ago

Image
1

448

hamlerlang/hamler repository overview

⁠The Hamler Programming Language

Hamler - Haskell-style functional programming language running on Erlang VM.

Hamler is a strongly-typed language with compile-time typechecking and built-in support for concurrency and distribution.

Hamler empowers industries to build the next generation of scalable, reliable, realtime applications, especially for 5G, IoT and edge computing.

⁠Why Hamler?

For almost a decade, we have been developing software systems based on Erlang/OTP, especially our main product EMQ X⁠ - the scalable open-source MQTT broker. So, we have always believed that Erlang is a masterpiece of engineering. With amazing concurrency, distribution and fault tolerance, it is one of the few general-purpose language platforms able to properly handle concurrency and soft realtime.

However, from all the experience writing Erlang, we believe that the following features can help Erlang programmer better adapt to the coming wave of 5G, IoT and edge-programming and attract more people for using BEAM.

  • Compile-time type checking and type reference
  • ADTs, Function Composition, Type Classes
  • More friendly syntax for prosperous communities
  • Functor, Applicative and Monad...:)

Now all the features are avaliable in the Hamler programming language.

⁠Features

  • Functional programming
  • Haskell and ML style
  • Compile-time type Checking/Inference
  • Algebraic data type (ADT)
  • Functions, higher-order functions
  • Currying and partial application
  • Pattern matching, and Guards
  • List comprehension
  • Applicative and Monad
  • Advanced module system
  • Built-in concurrency

⁠Design

The Hamler compiler architecture is shown as below:

hamler-compiler

The Hamler 0.1 compiler was forked from PureScript⁠ 0.13.6. The Hamler source code is parsed to generate CST, then CoreErlang's IR is generated after CST -> AST -> CoreFn's syntax tree transformation, syntax analysis and type checking. The code is then used by the Erlang compiler to generate the final Beam bytecode.

⁠Create a project

mkdir demo-project
cd demo-project
hamler init
make
make run

⁠Try the interpreter

hamler repl

> -- List, range and enums
> [1,2,3]
> [1..10]
> ['a'..'z']

> -- erlang style maps
> import Data.Map as Map
> -- New map
> m = #{"foo" => "bar", "bar" => "foo"}
> -- Match Map
> #{"foo" := a, "bar" := b} = m
> -- get, put
> Map.get "foo" m -- a = "bar"
> Map.get "bar" m -- b = "foo"
> m1 = Map.put "key" "val"
> -- keys, values
> keys = Map.keys m
> values = Map.values m
⁠Documentation

⁠Community, discussion and supports

You can reach the Hamler community and core team via the following channels:

⁠Contributing

To contribute to Hamler project:

⁠Core Team

The Hamler core team comes from EMQ Technologies Co., Ltd.⁠ now:

⁠License & Credits

We would like to express our great appreciation to the PureScript⁠ team and community for all years of efforts making its amazing compiler, especially CoreFn and its incredible adaptability.

The hamler language project is licensed under BSD3, see LICENSE⁠.

⁠About EMQ

EMQ⁠ is an open source software company providing highly-scalable, real-time messaging and streaming platform for IoT applications in 5G Era.

Tag summary

Content type

Image

Digest

Size

1.4 GB

Last updated

almost 5 years ago

docker pull hamlerlang/hamler:0.5