No description or website provided.
Switch branches/tags
Nothing to show
Clone or download
Josef Svenningsson
Josef Svenningsson Bugfix: Allow non-empty concrete lists
We used to report an error if we had a concrete list like '[1]' and
it should have type 'nonempty_list()'. Why? Because the list is
represented as a cons followed by a nil, and we require the tail of
the cons to have the same type as the whole cons. But this patch
weakens the demand on the type of the tail of the cons so that
it is always allowed to be the empty list.
Latest commit 12b3b71 Dec 5, 2018

README.md

Gradualizer: A Gradual Type System for Erlang

A type checker for Erlang

Travis CI Codecov

The idea

Gradualizer aims to integrate well into existing Erlang code bases in a non intrusive way. It does so by

  • having a type system that is based on the principles of Gradual Typing

  • using the existsing type specs syntax in Erlang.

  • allowing for granular opt-in of type checking. Without any type specs, no static typing happens.

    When type specs are added the program the program is checked against these specs statically. The more type specs, the more static typing.

Usage

To run Gradualizer from the command line:

  • Compile the project as an escript:

    make escript

  • Run Gradualizer:

    ./gradualizer

To run Gradualizer from the Erlang shell:

  • Launch the interactive prompt with all the relevant modules in the path:

    make shell

  • From the prompt you can run the type checker as follows:

    gradualizer:type_check_file(<path/to/some_file.erl>).

    You can try typechecking some of the example modules in the test directory.

To run Gradualizer from rebar3, read examples/rebar3/README.md.

The Gradualizer requires at least OTP 19 and is built using rebar3.

Status

The Gradualizer is in alpha. There are plenty of things that don't work right now. It is not meant for public consumption. That being said, pull requests are most welcome!

A non-exhaustive list of things which need fixing:

  • Integrate gradualizer with editors and build tools
  • Support for intersection types
  • Support for subtype polymorphism
  • Support for all language constructs in Erlang