3TYPES AND ENTITIES
The idea that every expression has a type is central to Haskell. Haskell has several built-in types available to us in the Prelude and a system for making our own types. In this chapter, we’ll discuss some of the built-in types, and in Chapter 10, we’ll see how to make types of our own.
Basic Types
Types reflect the nature of information. For example, in physics, we want to know whether something is a scalar or a vector. These are different types. It makes no sense to add a scalar to a vector, and the computer can prevent us from making this mistake if we use a good system of types.
Table 3-1 shows Haskell’s most important ...
Get Learn Physics with Functional Programming 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.