Category Theory for Programmers: The Preface

  Bartosz Milewski's Programming Cafe

Table of Contents

Part One

  1. Category: The Essence of Composition
  2. Types and Functions
  3. Categories Great and Small
  4. Kleisli Categories
  5. Products and Coproducts
  6. Simple Algebraic Data Types
  7. Functors
  8. Functoriality
  9. Function Types
  10. Natural Transformations

Part Two

  1. Declarative Programming
  2. Limits and Colimits
  3. Free Monoids
  4. The Yoneda Lemma
  5. Adjunctions
  6. Monads
  7. Comonads
  8. F-Algebras
  9. Algebras for Monads


For some time now I’ve been floating the idea of writing a book about category theory that would be targeted at programmers. Mind you, not computer scientists but programmers — engineers rather than scientists. I know this sounds crazy and I am properly scared. I can’t deny that there is a huge gap between science and engineering because I have worked on both sides of the divide. But I’ve always felt a very strong compulsion to explain things. I have tremendous admiration for Richard Feynman who was the master of simple explanations. I know I’m no Feynman…

View original post 1,284 more words

Why vitakka doesn’t mean ‘thinking’ in jhana

Sujato’s Blog

I shall give you a simile; for it is by means of a simile that some wise people here understand the meaning of what is said.


Here’s one of the most often contested issues in Buddhist meditation: can you be thinking while in jhana? We normally think of jhana as a profound state of higher consciousness; yet the standard formula for first jhana says it is a state with ‘vitakka and vicara’. Normally these words mean ‘thinking’ and ‘exploring’, and that is how Bhikkhu Bodhi translates them in jhana, too. This has lead many meditators to believe that in the first jhana one can still be thinking. This is a mistake, and here’s why.

Actually, right now I’m interested in a somewhat subtle linguistic approach to this question. But I’ve found that if you use a complex analysis of a problem, some people, understandably enough, don’t…

View original post 3,901 more words

Vitakka & Vicara – What do they mean?


Or: How do i find my way to the first jhana?Vitakka

Let’s say your meditation topic is Anapanasati (remembering the breath). So you would concentrate on breathing. If that is all you do, very soon, you would find yourself lost in millions of thoughts. Hopelessly washed away.

Now you make the following change to your practice:

With each breathing in you mentally note “in” with each breathing out you note “out”. Thatliterally is vitakka, or “thought“. Simple, as the Buddha mentioned. This thought will therefore help you to remember (lit. for sati, maintaining in your mental presence) the breathing (anapana).

Now, what the heck is “vicara“? It is gliding (literally ‘moving about’)! You don’t just think one thought and watch the breath. No, you have to repeat the thought and try to “glide”, “abide”, “skid”, “slide”, “dwell”, “ride” (all words denote a prolonged abiding, which…

View original post 348 more words

New draft on Normalization by Evaluation using GADTs


There is a new draft on my web page! It is called Tagless and Typeful Normalization by Evaluation using Generalized Algebraic Data Types, which is a mouthful, but only describes accurately the cool new OCaml development we elaborated together with Olivier and Chantal. The world of Normalization by Evaluation (NbE) is still relatively new to me, but its wonders keep amazing me. It’s a program specialization algorithm… no, it’s a completeness proof for first-order logic… wait, it’s a technique to turn an interpreter into a compiler! Definitely, Aarhus University, my new home, is not the worst place to learn about it.

Since the introduction of GADTs in OCaml, a whole new realm of applications emerged, the most well-known being to faithfully represent typed languages: it allows to define compact and correct interpreters, and type-preserving program transformations. Ok, if you never saw this, here is a small snippet that…

View original post 321 more words

Mads Torgersen repeating what I said a year ago

Building a C# compiler in F#

Neil Danson's Blog

A little over a year ago I wrote a post about Roslyn.

Recently (after seeing Mads Torgersen‘s excellent NDC-london talk) I was inspired to attempt to write my own mini-C# compiler to address some of the missing features in C#.

Mads Torgersen repeating what I said a year ago Mads Torgersen repeating what I said a year ago


Roslyn is a Microsoft project to rewrite the VB and C# compilers in their respective languages. After Mads talk, and listening to the (proposed) new features for C# 6 I couldn’t help but feel a little underwhelmed with the direction of C#.

Mads’ justification seems reasonable on the face of it – C# 2, 3,4 & 5 have all had major new language additions (namely generics, linq, dynamic & async) and that C# 6 is more of a ‘tidy the pain points’ release. But I had a number of ideas for improvements, and unfortunately only two are…

View original post 1,644 more words

Hello world!

Welcome to After you read this, you should delete and write your own post, with a new title above. Or hit Add New on the left (of the admin dashboard) to start a fresh post.

Here are some suggestions for your first post.

  1. You can find new ideas for what to blog about by reading the Daily Post.
  2. Add PressThis to your browser. It creates a new blog post for you about any interesting  page you read on the web.
  3. Make some changes to this page, and then hit preview on the right. You can always preview any post or edit it before you share it to the world.