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 Stack project. You can install Stack by following the instructions on the linked page.
The recommended text editor is Microsoft's Visual Studio Code. This has a nice Haskell extension that will do syntax highlighting, type checking and autocomplete for you. It also comes with a built-in Git implemenation, so you don't have to install that separately. I have prepared a short video that shows how to set up VS Code once you have it and Stack installed: CS316 : Getting started with VSCode (03:22) (Strathclyde students only).
If you don't want to use VSCode, or want to know what is going on behind the curtain, then you can clone and build the repository yourself. Here are the commands that you would type in on a Unix-like machine:
$ cd some/nice/directory # replace 'some/nice/directory' with a real one
$ git clone https://github.com/bobatkey/CS316-2021.git
$ cd CS316-2021
$ stack build
... lots of output, might download some things ...
$ stack exec hello-cs316
hello CS316!
$ stack ghci lecture-notes/Week01.hs
... will start the interactive Haskell compiler with Week 1's lecture notes loaded ...
The lecture notes for this course are intended to accompany the video lectures, 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
and
editing them. Each week also has a set of tutorial questions that you
should have a go at before the tutorial sessions on Fridays. The
solutions will be released after the session.
- Week 1 : Data and Functions Tutorial Problems, Start-the-week Notes.
- Week 2 : Solving Problems by Recusion Tutorial Problems, Start-the-week Notes.
- Week 3 : Higher Order Functions Tutorial Problems, Start-the-week Notes
- Week 4 : Patterns of Recursion Tutorial Problems, Start-the-week Notes
- Week 5 : Classes of Types Tutorial Problems, Start-the-week Notes
- Week 6 : Simulating side-effects: Exceptions, State, and Printing Tutorial Problems, Start-the-week Notes
- Week 7 : Monads Tutorial Problems, Start-the-week Notes
- Week 8 : Real I/O and Parser Combinators Tutorial Problems, Start-the-week Notes
- Week 9 : Data Dependencies and Applicative Functors, Start-the-week Notes
- Week 10 : Lazy Evaluation and Infinite Data
You can take a look at last year's repository for the same notes and some different exercises.