How Elixir Learns Types from Guards
summary
Elixir 1.20 computes precise types from actual guard expressions, turning guards like is_integer into concrete constraints, deriving intersection and union shapes, detecting negation types (map key absent, tuples of exact sizes, nonempty lists), and flagging impossible guards and redundant clauses. The checker uses pattern/guard ordering and standard library function preconditions (so-called reverse arrows) to refine inputs and outputs, emits more accurate warnings, recognizes raising paths as type none, and plans recursive types and polymorphism next.
AI-written summary · about
chapters (11)
- 0:00Elixir type inference from guards
- 1:05Precise domain inference benefits
- 2:08Guards enable advanced analysis
- 5:20Pattern matching and guard refinement
- 8:38Imprecise guard evidence handling
- 10:29Complex guard expressions analysis
- 13:17Guards and type accumulation
- 15:26Refining function inputs
- 18:15Type system improvements timeline
- 19:38Future work status
- 20:03Q&A on guards and safety
related talks
40mGradualizer: challenges implementing a type checker
40mTypes and Erlang from Dialyzer to (...)
46mThe Calculated Typer (Functional Pearl)
26mType Narrowing the Hard Way
27mTyping Erlang with eqWAlizer
01h 26mImplementing Dependent Pattern Matching and Type Unification Part 2
21mPapers We Love - Elixir Edition
19mA Dependently Typed Language with Dynamic Equality
