How it works...
In this recipe, we created two snaplets for two data types: one for MyData, and another for MyApp. The following list shows the important aspects of creating and composing snaplets:
-
The MyData contains a list of strings. The field _someData starts with an underscore. This is done so that makeLenses (a Haskell Template function) can generate a lens for accessing and setting the field. More information about lenses is covered in Chapter 11, Working with Lens and Prism. Note that, in this recipe, we do not use lens as such, and the use of lenses is strictly restricted to only where Snap APIs demand.
-
The makeSnaplet function takes the snaplet name, description, and an optional data directory on the disc. Here we have used ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access