Skip to Content
Effective Haskell
book

Effective Haskell

by Rebecca Skinner
July 2023
Intermediate to advanced
670 pages
17h 13m
English
Pragmatic Bookshelf
Content preview from Effective Haskell

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​.​ ...
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.
Start your free trial

You might also like

Grokking Functional Programming

Grokking Functional Programming

Michal Plachta
Grokking Algorithms

Grokking Algorithms

Aditya Bhargava
The Rust Programming Language, 2nd Edition

The Rust Programming Language, 2nd Edition

Steve Klabnik, Carol Nichols

Publisher Resources

ISBN: 9798888650400Errata Page