chapter five

5 Tooling for comma separation

 

This chapter covers

  • Using the record syntax to define data types that are maintainable and easy to work with
  • Defining your own type classes for data conversion
  • Generalizing concepts such as appending and slicing data
  • Handling text effectively with language extensions
  • Using foldings to effectively work with complex data
  • Writing powerful data transformations with the help of functors
  • Manipulating complex workflows based on user interaction

In the last chapter we tackled a search problem and wrote a powerful artificial intelligence for a childrens game. In this chapter however, we want to take care of earnest business and nothing screams business like spreadsheets! Don’t worry, we will not deal with any data directly. As programmers we obviously want to automate such tasks and the easiest way for us to deal with data in spreadsheet form are CSV files!

In this chapter we will cover how to parse such files, extract meaningful data from them, and how to work effectively with structured data. We will learn how to generalize appending and slicing of data and how to bring type classes into the mix to help us write our program.

5.1 Modeling tabular data

5.1.1 Breaking records

5.1.2 A smart construction

5.1.3 Dollar, dollar sign, y’all

5.2 Classes over classes

5.2.1 Can I haz default?

5.2.2 Slapping things together

5.3 Slice and dice

5.3.1 To export and re-export

5.4 Seeing patterns

5.5 Return to the fold

5.5.1 A fine line between right and wrong

5.6 We put the fun in mappings

5.7 Pretty little printings

5.7.1 Work with what you’ve got

5.7.2 To be at command

5.7.3 A selection of functionality