Welcome to the source code repository for the University of Strathclyde CS316 “Functional Programming” course.
This is a course designed to teach Haskell to undergraduate students. The written course materials are available from this repository. Video lectures and access to the Mattermost forum for this course are available to Strathclyde students via the course's MyPlace page.
The code in this repository is structured as a Cabal project. You will need to install GHC (the Haskell compiler) and Cabal to get started. It is also advisable to install HLS (the Haskell Language Server) and an LSP-capable editor (e.g. Emacs or VSCode) to read and edit the code.
To load the code into ghci
for interactive exploration, you can used
$ cabal repl
which will load all the lecture notes into the interactive ghci
repl. Use import WeekXX
to open a particular module for experimentation. Using the command :reload
to reload after any changes are made.
The lecture notes for this course are intended to accompany the video lectures (only available to Strathclyde students for now), and provide mostly the same information in a searchable, accessible and less bandwidth hungry format.
The notes are Haskell files with interleaved code and commentary. You are encouraged to experiment by loading these files into ghci
(using cabal repl
) and editing them. Each week also has a set of tutorial questions with solutions that you should have a go at to test your knowledge.
- Week 1 : Data and Functions
- Week 2 : Solving Problems by Recursion
- Week 3 : Higher Order Functions
- Week 4 : Patterns of Recursion
- Week 5 : Classes of Types
- Week 6 : Simulating side-effects: Exceptions, State, and Printing
- Week 7 : Monads
- Week 8 : Real I/O and Parser Combinators
- Week 9 : Data Dependencies and Applicative Functors
- Week 10 : Lazy Evaluation and Infinite Data
- Live Lecture Code (Tuesday) on deriving
Functor
by type-level programming. - Live Lecture Code (Friday) on testing with QuickCheck.
- Live Lecture Code (Tuesday) on deriving
You can take a look at last year's repository and the one before that for similar notes and some different exercises.