In this recipe, we will work with traversals, where we can use lens for traversing many fields.
Working with Traversal
How to do it...
- Create a new project working-with-traversal with a simple stack template.
stack new working-with-traversal simple
- Add a dependency on the lens library in the build-depends sub-section of the executable section. Also add containers, as we will be using Map in this recipe:
executable working-with-traversal hs-source-dirs: src main-is: Main.hs default-language: Haskell2010 build-depends: base >= 4.7 && < 5 , containers , lens
- Open src/Main...