Copyright
Brief Table of Contents
Table of Contents
Preface
Acknowledgments
About This Book
About the Cover Illustration
Chapter 1. Introduction to typing
1.1. Whom this book is for
1.2. Why types exist
1.2.1. 0s and 1s
1.2.2. What are types and type systems?
1.3. Benefits of type systems
1.3.1. Correctness
1.3.2. Immutability
1.3.3. Encapsulation
1.3.4. Composability
1.3.5. Readability
1.4. Types of type systems
1.4.1. Dynamic and static typing
1.4.2. Weak and strong typing
1.4.3. Type inference
1.5. In this book
Summary
Chapter 2. Basic types
2.1. Designing functions that don’t return values
2.1.1. The empty type
2.1.2. The unit type
2.1.3. Exercises
2.2. Boolean logic and short circuits
2.2.1. Boolean expressions
2.2.2. Short circuit evaluation
2.2.3. Exercise
2.3. Common pitfalls of numerical types
2.3.1. Integer types and overflow
2.3.3. Arbitrarily large numbers