Records and deep access
Before we dive into lenses, let’s review Haskell’s built-in support for data access and its shortcomings.
Haskell’s built-in support for data access is the named fields of record types that we first saw in Chapter 2, Algebraic Data Types. Here is a small example of this:
data Employee = MkEmployee { firstName :: String , lastName :: String , salary :: Int }
This Employee
type has one data constructor, MkEmployee
, with three...