In this recipe, we will be working with the lens library. This library provides a whole battery of functions. We will be using some of those functions. We will also create lenses for our own data type.
Working with lenses
How to do it...
- Create a new project working-with-lenses, with a simple stack template:
stack new working-with-lenses simple
- Add a dependency on lens library in the build-depends sub-section of the executable section:
executable working-with-lenses hs-source-dirs: src main-is: Main.hs default-language: Haskell2010 build-depends: base >= 4.7 && < 5 , lens
- Open src/Main.hs. We will...