July 2023
Intermediate to advanced
670 pages
17h 13m
English
Before we took a detour to learn about do notation, we had just finished adding support for collecting metadata about the files that we are going to view, and writing a function to display that information in a status bar. Now that we know about do notation we’ll be able to take on a small bit of refactoring work to make integrating this feature into our application easier.
The first thing that we need to do is to update our paginate function to add the status bar to the end of each page of text that we generate. Let’s take a look at the refactored version of paginate and then we can briefly walk through what it’s doing:
| | paginate :: ScreenDimensions -> FileInfo -> Text.Text -> [Text. ... |