Is a burrito a monad?

tomsherman

Tom Sherman

Posted on July 25, 2020

Is a burrito a monad?

This post was originally posted on my blog.


As we all know, a monad is just a monoid in the category of endofunctors. This is intuitive to you and I, but what if you need to explain what a monad is in more practical terms. Well that's where the three laws of monads come in.

These three laws act as a test to tell if something is a monad - if that something passes the three laws, then it's a monad - simples.

Now to the main event, is a burrito monad? Well let's see if it obeys the three laws...

Left identity

Take your filling, put it in a burrito - toast it - take the filling back out - the filling is warm just as if you toasted the filling itself.

So the burrito passes the first law.

Right identity

Unwrap the burrito to get to the filling.

The burrito passes the second law.

Associativity

Putting hot sauce in your burrito and then toasting it is the same as toasting it and putting hot sauce in your burrito.

Thus the burrito passes the third law.

The burrito is a monad ๐ŸŒฏ

Further reading

Burritos for the Hungry Mathematician by Ed Morehouse

๐Ÿ’– ๐Ÿ’ช ๐Ÿ™… ๐Ÿšฉ
tomsherman
Tom Sherman

Posted on July 25, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

ยฉ TheLazy.dev

About