2 Ancient secret keeping on modern machines

 

This chapter covers

  • How to set up a basic Haskell project and run some code
  • Common Haskell data types and how functions work
  • Performing basic operations with strings and lists
  • Using guards and pattern matching for handling case distinctions
  • Working with immutable data and how to represent transformations

In the last chapter, we learned what Haskell is and discussed its peculiar language design decisions. We also learned some specifics on pure functions and how pure functional programs, such as the ones we write with Haskell, are structured. Although it is essential to understand these concepts, it’s not much use talking about them, without getting our hands a bit dirty. You can’t learn the application of theory without applying anything. So let’s get down to implementing our first project!

2.1 A primer on Haskell

2.1.1 Caesar’s cipher

2.1.2 A new project

2.1.3 The first module

2.2 Typical types and fantastic functions

2.2.1 Types on the atomic level

2.2.2 Lists and tuples

2.2.3 Function types

2.2.4 Adding types to math

2.3 A little help with the alphabet

2.3.1 Synonymous types for readability

2.3.2 The kinds of letters

2.3.3 Logical combinations

2.4 Rotating the wheel

2.4.1 Finding an element’s index

2.4.2 Finding the element at an index

2.4.3 Guarding control flow

2.5 Transforming a string

2.5.1 A higher-order mapping

2.5.2 Parameterizing types

2.5.3 A finished cipher

Summary