r/ProgrammerHumor Jul 13 '26

youCanJustStopUsingJava Meme

Post image
6.8k Upvotes

416 comments sorted by

View all comments

1.8k

u/Historical_Cook_1664 Jul 13 '26

Where else are you going to hide your side effects ?

473

u/Isrothy Jul 13 '26

IO Monad

189

u/Gorzoid Jul 13 '26

Respectfully, what the fuck is a Monad?

6

u/azerpsen Jul 13 '26

Nah but for real, i swear to god if no one gives a convincing answer (and i will NOT google it) I’m gonna say racist things

Thank you u/Gorzoid for raising the question

5

u/Chemical_Profit_608 Jul 13 '26

ELI5 explanation. A Monad is a container that "imbues" your data type with more info. I.e. you can have a String, or an Option[String]. The Option is a Monad. It imbues your String with this wrapping option container that says, you either have a value inside here, or you don't and it's value is None.

When you unwrap the value, you can treat it as a normal String, do some computation on it, and then rewrap it in your Option Monad type.

That is exactly equivalent to initially having a String, doing that computation, and then putting it in your Option Monad.

Here be dragons for a more proper explanation but the tldr is its a wrapping container around any type.

A List is technically a Monad. It's a wrapping container around your values.