Brendan Fong, Bartosz Milewski, and David Spivak

Department of Mathematics
Massachusetts Institute of Technology
Office: 2-180
Email: {bfo,dspivak} -- mit/edu

18.S097: Programming with Categories

IAP 2020

General information

Dates: Jan 7—31 (MTWRF)
Time: 2—3pm
Prerequisites: None
Credit: 3 units (1-0-2) (P/D/F)

Summary: In this course we explain how category theory—a branch of mathematics known for its ability to organize the key abstractions that structure much of the mathematical universe—has become useful for writing elegant and maintainable code. In particular, we'll use examples from the Haskell programming language to motivate category-theoretic constructs, and then explain these constructs from a more abstract and inclusive viewpoint. Hands-on programming exercises will be used to demonstrate categorical ideas like "the universal property of products" in working Haskell code. A rough list of topics includes:
  1. Sets, types, categories, functors, natural transformations
  2. Universal constructions and associated data types
  3. Adjunctions and cartesian closed categories
  4. Algebras, catamorphisms, anamorphisms
  5. Monads, comonads, Kleisli arrows
  6. Monoids, monoidal categories, lax monoidal functors, applicatives
  7. Profunctors, (co)ends, optics
We will assume no background knowledge on behalf of the student, starting from scratch on both the programming and mathematics. (Flyer)

Students are very welcome to audit.

Course details

Course notes and videos will be published here following each class. Feedback about the notes is welcome here or via email to the instructors.

Students taking the course for credit will be required to complete three problem sets. There will be no exam. See the syllabus for more details.

The instructors will lead problem discussion and be available for questions each day from 3 to 4pm, in the course classroom, 4-163.

There will be no class on Monday 1/20 (MLK Day).

Course resources

Problem sets

Open access and remote participation

All are welcome to attend the lectures in person. We encourage those participating remotely to post questions and discuss course content on the Azimuth Forum.

Additional resources

Mailing list

Join the mailing list to get updates.

Commons License This work by Brendan Fong, Bartosz Milewski, and David Spivak is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.