Skip to content
forked from esl/gradient

Gradient is a static typechecker for Elixir

License

Notifications You must be signed in to change notification settings

DivvyPayHQ/gradient

 
 

Repository files navigation

Gradient

Build Status

Gradient is a gradual typechecker for Elixir.

Gradual typing is a bit like static typing, because it provides error messages if your code has types and specs - and any errors, obviously. Gradual typing is also a bit like dynamic typing, because it doesn't require all the functions to have specs and just agrees when you say: "Trust me, I'm a (software) engineer!"

Gradient relies on Gradualizer as the actual typechecker, but aims to make jumping the hoops between your Elixir code and the Erlang abstract syntax tree that Gradualizer works on effortless.

Usage

Gradient can be installed by adding gradient to your list of dependencies in mix.exs:

def deps do
  [
    {:gradient, github: "esl/gradient", only: [:dev], runtime: false}
  ]
end

Gradient comes with a Mix task that runs the typechecker on an Elixir project:

mix gradient

And presents errors in Elixir syntax.

Here is an example with some errors:

Result of app with errors

And here is an example of an application that has no issues:

Result of app without errors

Also, did we mention the analysis process is lightning fast?

Speed of analyzing app with errors

The examples/ folder contains example applications showing how the produced error messages look like.

Caveats

Gradient is experimental! Please use it and let us know how it feels. We're especially looking for code snippets where it doesn't work the way you'd expect it to, together with an explanation of what's happening and what's expected. Together, we can make it robust and convenient to work with, so that we all feel more productive!

About

Gradient is a static typechecker for Elixir

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Elixir 99.9%
  • Erlang 0.1%