Capstone A: a CSV report processor
The first capstone of the Haskell course builds a CSV report processor in seven lessons. It reads a file of rows, parses a line into a record, folds the rows into a grouped total and prints a fixed-width report. The last three lessons stream the input without holding the file, take the arguments from the command line, and test the parser on a table of good and bad lines.
104
Capstone A: reading the file
a CSV file on disk, readFile, lines, the shape of the data
Open
105
Capstone A: parsing a line
splitOn, a field type, a bad line with its number
Open
106
Capstone A: the record and the total
a record type, a fold over the rows, money as an integer
Open
107
Capstone A: the report
a grouped total, a sorted report, a fixed-width table
Open
108
Capstone A: streaming the input
interact, lazy lines, a filter that never holds the file
Open
109
Capstone A: the command line
getArgs, a subcommand, a usage message, the exit code
Open
110
Capstone A: testing the parser
a table of good and bad lines, a runner, the failures it finds
Open