3 Developing an application: Stock quotes

 

This chapter covers

  • Designing a standalone multimodule Haskell program with dependencies
  • Dealing with dates, text, and command-line arguments
  • Parsing CSV files and plotting charts
  • Employing type classes for practical needs

There is a common pattern for many utility programs: we have some data in a form that is not convenient for analysis and want to present the data, visually or textually. While implementing such a program, we have to address many issues, such as interfacing with a user, designing data types for an application domain, reusing external packages for parts of the program, and more. We should also think about language features that can help us in terms of correctness, performance, and an ability to extend functionality, if needed.

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 data types, functions, and modules, followed by a discussion of useful Haskell packages and implementation details. We’ll also see how type classes can make our programs much more flexible and resilient to changes.

3.1 Setting the scene

3.1.1 Inputs

3.1.2 Outputs

3.1.3 Project structure

3.2 Exploring design space

3.2.1 Designing the user interface

3.2.2 Dealing with input data

3.2.3 Formatting reports

3.2.4 Plotting charts

3.2.5 Project dependencies overview

3.3 Implementation details

3.3.1 Describing data

3.3.2 Plotting charts

3.3.3 Preparing reports

3.3.4 Implementing the user interface

3.3.5 Connecting parts

Summary