The ways that you choose to document and organize your code are more subjective than most of the topics we’ll cover in this book. As you start to work on these exercises you’ll realize there are several reasonable ways to approach them. For each of the exercises, try out a few different approaches to get a feel for the pros and cons of each, and to start developing your own personal style.
Refactoring UserInfo
Refactor the HaskellBook.Examples.UserInfo module into smaller modules. Try to look at different ways that you can separate out the concerns of authentication, looking up a particular user, and getting information about a user.
Old New Projects
Use cabal and create projects for all of the examples that you’ve already worked on as you’ve been working through this book. Consider how you might organize the modules to maximize re-use in cases where we worked through several variations of a single example.
Document Your Modules
Review the projects that you created in this chapter, as well as any cabal projects you created while working through previous examples, and document them. Make sure to check out the official Haddock documentation [11] to find out about more ways that you can effectively format your documentation.
Footnotes
[3]
[4]
[5]
[6]
https://cabal.readthedocs.io/en/3.4/index.html
[7]
https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/flags.html
[8]
https://haskell-haddock.readthedocs.io/en/latest/
[9]
[10]
https://haskell-haddock.readthedocs.io/en/latest/index.html
[11]
https://haskell-haddock.readthedocs.io/en/latest/index.html
Copyright © 2023, The Pragmatic Bookshelf.