Learning Module 2 — Algebraic Data Types

Why this is important: The ability to define your own types is critical for a programming language to be useful over time. Arguably, the APL language died because it was not extensible. We will use Haskell’s datatype syntax extensively to represent programming languages.

Outcomes

  • 2.1 – Given reference code, write the corresponding datatype declaration (2 points)
  • 2.2 – Given a datatype declaration, write a recursive function that consumes the datatype. (2 points)
  • 2.3 – Given a datatype declaration, write a recursive function that transforms the datatype (3 points)
  • 2.4 – Given a datatype declaration, write a function that produces it from some other input. (3 points) 25%
Previous
Next