What the fuck is a monad?

Or: functor? I 'ardly know 'er!

Monads are difficult to explain without sounding either patronizing or condescending: I would sound patronizing if I came up with some facile analogy and I would be condescending to describe it categorically.

Instead, I'll frame a problem and piece-by-piece solve the problem with what will turn out to be a monad.

View index.html
<!DOCTYPE html>
<title>Large Type</title>
<link rel="stylesheet/less" type="text/css" href="style.less">
<script type="text/javascript" src="lib/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="lib/less.min.js"></script>
<div class="out"><span contenteditable autofocus>*hello*</span></div>
View yet-another-conway.hs
{-# LANGUAGE DeriveFunctor #-}
import Control.Applicative
import Control.Comonad
import Control.Monad (forM_)
-- These two typeclasses probably make some people groan.
class LeftRight t where
left :: t a -> t a
# Markov models!
# A Markov model of some process is a model of different states you can be in,
# where each state links to other states. These links are weighted by some
# probability score. Markov models are designed to model systems where future
# states depend only on the present state.
# In the case of words you may define "present state" to be "the current word,"
# or perhaps "the last 3 words."
View unification.hs
import Data.Maybe (isNothing)
import Data.Monoid ((<>))
import Data.List (nub, union)
import Control.Monad (forM_)
-- * The propositional language
-- | Term grammar
data Term
= V Int -- ^ Variable with unique numeric identifier
# source:
sudo rm -rf /Library/Frameworks/GHC.framework
sudo rm -rf /Library/Frameworks/HaskellPlatform.framework
sudo rm -rf /Library/Haskell
rm -rf .cabal
rm -rf .ghc
rm -rf ~/Library/Haskell
View output.txt
Code: (+ 5 5)
Free (AApp (Free (ASymbol "+")) [Free (ANumber 5),Free (ANumber 5)])
Code: (lambda (x) (* x x))
Free (ALambda [Free (ASymbol "x")] (Free (AApp (Free (ASymbol "*")) [Free (ASymbol "x"),Free (ASymbol "x")])))
Code: ((\ (x) (* x x)) 5 (+ 10 2))
Free (AApp (Free (ALambda [Free (ASymbol "x")] (Free (AApp (Free (ASymbol "*")) [Free (ASymbol "x"),Free (ASymbol "x")])))) [Free (ANumber 5),Free (AApp (Free (ASymbol "+")) [Free (ANumber 10),Free (ANumber 2)])])
Code: '(1 2 3)
View imperative.lhs
How to add imperative programming to a pure functional language
Many people bemoan languages such as Haskell for not supporting imperative
programming; they decry the need for math in their computer science.
![Math? In my computer? Yeah right.](
I'm here to tell you that not only does Haskell make imperative programming a
cinch, but safe and correct as well. Follow along! This post is written in
View audio
# Script to launch jackd and reroute PulseAudio through it. And optionally
# start fluidsynth.
# Usage (assuming this script is named `audio`, is in your PATH, and is

Bike Math!

Note: For the sake of clarity I'll probably write things you already know. It's just as much to eliminate communication errors as it is for me to keep track of what the fuck I'm even talking about. It does not imply any kind of judgment of what I assume about you :)

Here's the math behind gears and how they are used to efficiently rotate wheels. The same principles underlie how cars work but the mechanisms are