Category theory for Scala Programmers -Kleisli Categories

This post is an attempt to explain a “Kleisli” category in as simple way as possible. Many before have tried and some have succeeded.

A category consists of objects and arrows that go between them. These arrows compose such that if there is an arrow from A to B and another arrow from B to C, then there must be an arrow from A to C.

This is category theory 101. In Scala these objects are represented by types and the arrows are functions that are defined in these types. So, if we have three types A, B and C…