September 2013
Intermediate to advanced
548 pages
12h 25m
English
Some of the errors the dialyzer produces are pretty strange. To understand these errors, we have to understand the process by which the dialyzer derives the types of Erlang functions. Understanding this will help us interpret these cryptic error messages.
Type inference is the process of deriving the types of a function by analyzing the code. To do this, we analyze the program looking for constraints; from the constraints, we build a set of constraint equations, and then we solve the equations. The result is a set of types that we call the success typing of the program. Let’s look at a simple module and see what it tells us.
| dialyzer/types1.erl | |
| | -module(types1). |
| | -export([f1/1, f2/1, f3/1]). |
| | |
| | f1({H,M,S}) ... |
Read now
Unlock full access