Programming with Types
Vlad Riscutia
  • MEAP began April 2019
  • Publication in Early 2020 (estimated)
  • ISBN 9781617296413
  • 325 pages (estimated)
  • printed in black & white

This is by far one of the most extensive and well written books I've personally read on Types.

Justin Coulston
Type-related failures are common and can be very costly. Famously, in 1999, NASA’s Mars Climate Orbiter burned up in the atmosphere because of an error that could have easily been prevented with typing. By taking advantage of the strong type systems available in most modern programming languages, you can eliminate whole classes of errors. Programming with Types teaches you type system techniques for writing software that’s safe, correct, easy to test and maintain, and that practically documents itself. Master these techniques, and you may even help prevent an interstellar catastrophe!
Table of Contents detailed table of contents

1 Introduction to Typing

1.1 Who 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

1.6 Summary

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.2 Boolean logic and short circuits

2.2.1 Boolean expressions

2.2.2 Short circuit evaluation

2.3 Common pitfalls of numerical types

2.3.1 Integer types and overflow

2.3.2 Floating-point types and rounding

2.3.3 Arbitrarily large numbers

2.4 Encoding text

2.4.1 Breaking text

2.4.2 Encodings

2.4.3 Encoding Libraries

2.5 Building data structures with arrays and references

2.5.1 Fixed-size arrays

2.5.2 References

2.5.3 Efficient lists

2.5.4 Binary Trees

2.5.5 Associative Arrays

2.5.6 Implementation tradeoffs

2.6 Exercises

2.7 Summary

3 Composition

3.1 Compound Types

3.1.1 Tuples

3.1.2 Assigning Meaning

3.1.3 Maintaining Invariants

3.2 Expressing “Either-Or” with Types

3.2.1 Enumerations

3.2.2 Optional Types

3.2.3 Result or Error

3.2.4 Variants

3.3 The Visitor Pattern

3.3.1 A Naïve Implementation

3.3.2 Using the Visitor Pattern

3.3.3 Visiting a Variant

3.4 Algebraic Data Types

3.4.1 Product Types

3.4.2 Sum Types

3.5 Exercises

3.6 Summary

4 Type Safety

5 Function Types

6 Advanced Applications of Function Types

7 Subtyping

8 Elements of Object Oriented Programming

9 Generic Data Structures

10 Generic Algorithms

11 Higher Kinded Types

About the Technology

As software grows in complexity, it’s essential to adopt coding tools and strategies that enforce safety and correctness. A type system governs what types of data are allowable, requiring your code to accurately store, represent, and use its internal data. Recent efforts to bring type safety to dynamic languages like Python and JavaScript shine a light on the benefits—and the importance!—of type systems. Relying on the compiler to catch type mismatches ensures code will operate correctly at runtime. Type-aware programming also ensures data integrity, enables data encapsulation, and allows new components to be composed from existing ones.

About the book

Programming with Types teaches you to design safe, resilient, correct software that’s easy to maintain and understand by taking advantage of the power of strong type systems. Designed to provide practical, instantly-useful techniques for working developers, this clearly-written tutorial introduces you to using type systems to support everyday programming tasks. In it, you’ll explore the impact types have on functions, inheritance, and composition, and you’ll take a close look at generics, which enable greater abstraction. You’ll also discover folding data structures and applying functions to containers with higher kinded types. Along the way, you’ll explore real-world use cases and practical examples in TypeScript as you build your skills from primitive types up to more advanced concepts like functors and monads.

What's inside

  • An introduction to type systems and their benefits
  • Designing functions that don’t return values
  • Encoding text
  • Building data structures with arrays and references
  • Type composition
  • Function types
  • Type safety
  • Asynchronous functions
  • Subtyping
  • Object-oriented programming with types
  • Generic data structures and algorithms

About the reader

Readers need basic high school math skills as well as some programming experience in a mainstream programming language like Java, JavaScript, C#, or C++.

About the author

Vlad Riscutia is a principal software engineer at Microsoft with over 10 years of experience in the software field. He has headed up several major software projects and mentored many up-and-coming software engineers.

Manning Early Access Program (MEAP) Read chapters as they are written, get the finished eBook as soon as it’s ready, and receive the pBook long before it's in bookstores.
MEAP combo $49.99 pBook + eBook + liveBook
MEAP eBook $39.99 pdf + ePub + kindle + liveBook

placing your order...

Don't refresh or navigate away from the page.

FREE domestic shipping on three or more pBooks