3 Processing stock quote data: An example
This chapter covers:
- Designing a standalone multi-module Haskell program with external packages
- Dealing with dates, times, texts, and command-line arguments
- Parsing CSV files and drawing charts and
- Employing type classes for practical needs
There is a common pattern for many utility programs: you have some file with data in a form that is not convenient for analysis, and your goal is to present this data somehow, graphically or textually. While implementing such a program you’ll have to address many issues, such as interfacing with the user, designing datatypes for the application domain, reusing external packages for parts of the program, and more. You should also think about how language features can help you in terms of correctness, efficiency, and the ability to extend functionality.
In this chapter we’ll explore the process of developing such a program. I’ll start by describing inputs and outputs, then move on to design issues with datatypes and functions, followed by a discussion of useful packages and implementation details. You will also see how type classes can make your programs much more flexible and resilient to changes.