Category Theory

[)roi(]

Executive Member
Joined
Apr 15, 2005
Messages
6,282
Reaction score
405
Location
Much of the mystery and intrigue behind Functional Programming is derived from early research work that was done by Samuel Eilenberg and Saunders Mac Lane in 1942, specifically their attempts to quantify the processes that preserve mathematical structure.

It's from this base foundation that most of the more recent concepts of Functional Programming were derived, for example, both of these concepts came from this initial work:
Functional Programming can be quite daunting to start out with, especially considering much of the technicalities that underpin this; what primarily is missing from most introductions is a basic understanding of the foundation tenets of category theory, and its in that respect I'll be sharing what I consider to be one of the more simpler introductions to this area of mathematics:
Targeted Level; taken from the book:
I have assumed no more mathematical knowledge than might be acquired from an undergraduate degree at an ordinary British university, and I have not assumed that you are used to learning mathematics by reading a book rather than attending lectures.


Note:
  • Concepts like Optics (Lenses, Prisms, Profunctors) and Applicative Functors like (Futures and Promises) are advanced topics so I'd advise avoiding this until you have understood the basics; that's where the "Basic Category Theory" book fits in; its there to help to fill in some of the gaps.
  • As to how this knowledge is applied and taken advantaged of. The Internet has many examples of this; and most languages will cover e.g. how functors are used; whereas this book will explain why this approach was adopted i.e. the foundational thinking behind this approach.
  • Many concepts are equally well covered in most language documentation; except for the more recent advances like Applicative Functors and Optics, which aren't implemented in e.g. Java or C#, but can be found as implementations in the open source community.
  • Personally I'm (in my spare time) working on a way to represent these topics in a few languages (C#, Java, Swift...) with the goal to simplifying a lot of this; however as it's a very broad subject I cannot expect to completely cover the basics in sufficient detail for everyone; hence the book is meant to cover this shortfall. My examples however will aim to make this more practically relevant i.e. show how these concepts can help to solve issues that we typically encounter when building applications.

Btw as final point I think it's important to make a distinction between using functions like:
  • map, reduce, flatmap, futures, promises, reactive programming, etc.
...and understanding how they work, are built & designed.

Using these typically requires learning a new declarative style API, and practically you aren't expected to initially understand the plumbing to employ this in your code. However in the long run, understanding the plumbing is what will allow you to apply these concepts in far more areas including in your own custom types / classes, fine tuning multithreading and asynchronous events, etc.

If however you just want to explore examples of how these techniques are employed in real world examples, then the recently release Purescript book is a good resource with examples.; download it here.
 
Last edited:
Top
Sign up to the MyBroadband newsletter
X