gyson/ex_type
{ "createdAt": "2019-02-24T15:41:41Z", "defaultBranch": "master", "description": "A type checker for Elixir", "fullName": "gyson/ex_type", "homepage": "", "language": "Elixir", "name": "ex_type", "pushedAt": "2023-03-24T12:53:16Z", "stargazersCount": 34, "topics": [ "checker", "elixir", "gradual-typing", "type" ], "updatedAt": "2025-08-27T12:19:23Z", "url": "https://github.com/gyson/ex_type"}ExType
Section titled “ExType”A type checker for Elixir.
Feature
Section titled “Feature”- gradual typing
- type check for protocols and generic protocols
- type check with intersection and union types
- type guards
- type assertion
- type inspection
Installation
Section titled “Installation”The package can be installed by adding ex_type to your list of dependencies in mix.exs:
def deps do [ # Required developement dependency {:ex_type, "~> 0.5.0", only: :dev, runtime: false},
# Optional runtime dependency {:ex_type_runtime, "~> 0.2.0"} ]endTo help ExType infer types, following rules are required:
-
All public functions require explicit typespecs.
-
All recursive functions require explicit typespecs.
Basically, you do not need to add a typespec for non-recursive private functions.
# type check for all code$ mix type
# type check for specified module$ mix type ExType.Example.Foo
# type check for specified named function$ mix type ExType.Example.Foo.hello
# type check for named function with specified arity$ mix type ExType.Example.Foo.hello/0Example
Section titled “Example”There are some examples in lib/ex_type/example/ directory.
Status
Section titled “Status”This project is still in a very early stage with active development. You are likely to hit uncovered cases when playing more complex code beyond the examples. Be free to submit a github issue for a bug report or any feedback.
Roadmap
Section titled “Roadmap”Plan to apply ExType to following small-sized libraries first:
Development Note
Section titled “Development Note”-
Use
MIX_ENV=test iex -S mixto access test context. -
It uses serveral Elixir private APIs. It should be ok for now because
ex_typeis a development dependency, not a runtime dependency. Would like to reduce private API usage at later time when the project is more mature.
License
Section titled “License”MIT