Lets take those three things and analyse them one by one. Then together. And see what we find.

They are values wrapped inside contexts. And we can define operations and say what should happen given the context, eg:

instance Functor Maybe where
    fmap func (Just val) = Just (func val)
    fmap func Nothing = Nothing

Approximate English translation: We define Maybe: when presented with a value inside a context, apply the function to the value and rewrap the result; when presented with no value inside the context, do nothing and return a context with no value inside.

Here’s what is happening behind the scenes when we write fmap (+3) (Just 2):

  • Jokes

They are unexpected context switches. The newly switched version, or “bad interpretation” is usually not socially acceptable or hurting somebody or a group, causing the fun. The “bad interpretation”, if hurting, has to escape common knowledge. That’s why we don’t usually explain jokes.

But the funny business about how the bad interpretation should be inferred by everyone (“inferring the bad interpretation” is the same “getting the joke”) is merely a details about how jokes work. What is at interest here is the mechanic about sudden context switching.

Some examples:

How do you make holy water? You boil the hell out of it.

Context 1: regular boiling of water
Context 2: you remove “hell” from the water
The play on word makes the two contexts cohabit. Religious people are somewhat hurt

Why did the blonde get excited after finishing her puzzle in 6 months? – The box said 2-4 years!

Context 1: (in blonde’s mind) Finishing a puzzle meant to be solved in 2 to 4 years in only 6 months
Context 2: Finishing a puzzle meant for 2 to 4 years kids in 6 longs months
Context switch possible because of blonde’s misinterpretation of “2-4 years” notice. Blondes are hurt.

If con is the opposite of pro, it must mean Congress is the opposite of progress?

Context 1: progress and congress are two very different entities
Context 2: they must be opposite
Context switch forced by hypothesis. Congress is hurt.

I wondered why the frisbee was getting bigger, and then it hit me.

Context 1: Guy finally understands why frisbee was getting bigger
Context 2: Guy is hit by frisbee
Context switch hinges on play on word “it hit me”. Guy is somewhat hurt

Today a man knocked on my door and asked for a small donation towards the local swimming pool. I gave him a glass of water.

Context 1: (pov of guy asking) Expecting a small money donation
Context 2: (pov of guy responding) Giving him water directly
Context switch is in the difference of what first guy expects and second guys does.

Apparently I snore so loudly that it scares everyone in the car I’m driving.

Context 1: Guy snores in night at bed
Context 2: Guy sleeps while driving
Context switch is made when one is representing the scene and happens mid-sentence.

To recap, in each of these, we first establish a context. For longer jokes, this is usually the bulk of the joke. Then comes the punchline that forces the context to be rethought. The punchline can be just a few words, as in “in the car I’m driving”.

Schematically, we have:

  • Establish situation 1 with context 1
  • punchline forces context 2
    (Laugh ensues because context 2 causes situation 1, which does not changes, to be awkward for somebody. Awkwardness escapes common knowledge because everyone infers the joke independently).

Quick detour about funny situations: Understanding a problem/situation with incorrect context can lead to very interesting failure modes.

  • Analogies

I’ve talked about them before, so I’ll just give a quick overview: they are an identity of structure between two things/concepts.



So we have:

  • monads: putting things in/out of context to apply certains operations
  • jokes: waiting until the very last moment to rethink the context that renders the situation funny
  • analogies: two things being similar ?

If we want analogies to fit in, we can simply view them differently: instead of being two different things with the same structure, we can say: rather, it is about stripping two things of their respective contexts so they become the same. This makes us think differently about analogies: instead of being a mapping operation, they are an equality operation. And because we need to lift (or substract) the context in the process, maybe a diff operation.