Showing the Status Bar and Refactoring runHCat
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. ... |
Get Effective Haskell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.