Elixir Types REPL

Ready
Input
Output
No results yet.
Aliases
none
Reference
type a = t ;; Defines an alias that persists for this browser session.
t ;; Normalizes and prints a type.
a <= b ;; Tests subtyping. Use a = b ;; for semantic equality and a >= b ;; for reverse subtyping.
a <~ b ;; Tests gradual precision. a <~= b is accepted as the same relation.
a <=~ b ;; Tests consistent subtyping, defined as lower(a) <= upper(b).
a ~<= b ;; Tests Elixir compatibility from left to right.
{a, a} when a: term() ;; Introduces local type variable a. A narrower bound, such as a: integer(), intersects every occurrence of a with that bound.
[a <= s ; t <= a] ;; Tallies subtype constraints and prints principal substitutions. Unknown lowercase identifiers inside brackets are type variables; separate constraints with semicolons.
t s ;; Applies function type t to argument type s. Define multi-arity functions with (s1, s2 -> ret) and apply with t (s1, s2) ;;.
list(t, tail) List aliases are list(), list(t), and list(t, tail); non-empty lists use non_empty_list(t) or non_empty_list(t, tail).
t[s] ;; Models Elixir map[key] access; the result includes nil when a key can be absent.
t.a ;; Selects required map/record field :a; this errors when the field is absent or optional.
precise? head ;; Checks pattern and guard precision, as in precise? {x, y} when x == y ;;.
a or b Set union. Intersections and differences are a and b, a and not b, and not a.
{integer, ...} Open tuple syntax. Maps use %{foo: integer}, %{..., foo: integer}, or %{atom() => integer()}.
Use Ctrl+Enter, or Cmd+Enter on macOS, to run the input.