Skip to content
AgileLogics
Intermediate 5 min read

Intermediate Projects

Prerequisites: Level 2 — Intermediate

Build these using algebraic data types, type classes, monads, Data.Map, error handling, and cabal projects from Level 2.

1. Expression Evaluator

Define data Expr = Num Double | Add Expr Expr | Mul Expr Expr | Div Expr Expr | Var String, write eval :: Map String Double -> Expr -> Either String Double that reports division by zero and unknown variables, and a pretty-printer that adds only the parentheses that are needed.

2. Todo List Manager

A cabal project with a Todo record, commands to add, complete, list, and delete items (from getArgs), and storage in a text file that is read with readFile and parsed safely with readMaybe.

3. Bank Account Simulator

Model accounts in a Map AccountId Account, and transactions as a sum type. Apply a list of transactions with a fold, returning Either TransactionError for overdrafts and unknown accounts.

4. CSV Report Tool

Read a CSV file of sales, split lines with a small hand-written parser, group totals by region with Map.fromListWith, and print the results sorted by total. Put the parser and report in separate modules.