Chapter 9Types

Erlang has a type notation that we can use to define new data types and add type annotations to our code. The type annotations make the code easier to understand and maintain and can be used to detect errors at compile time.

In this chapter we’ll introduce the type notation and talk about two programs that can be used to find errors in our code.

The programs we’ll discuss are called dialyzer and typer and are included in the standard Erlang distribution. Dialyzer stands for “DIscrepancy AnaLYZer for ERlang programs,” and it does precisely that which is implied by its name: it finds discrepancies in Erlang code. typer provides information about the types used in your programs. Both the dialyzer and typer work perfectly well ...

Get Programming Erlang, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.