News for hackers. Stuff that matters.
Re:A Burrito Is a Monad by bazoom42 on Monday September 30, 2024 @02:58PM (#41700713)
A “type that wraps another type” describes some monads like List or Maybe but not other monads like the IO monad.

A monad is a type which support a particular pattern of function chaining. But the caining will have semantics which depend on the particular monad type, so it is difficult coming up with a metaphor which apply to all monads.

Re:A Burrito Is a Monad by jpc0 on Tuesday October 01, 2024 @04:45AM (#41706029)
The IO monad, just like the state monad is still just a type wrapping another thing... In those cases, it is wrapping side-effects.

But I don't agree that a burrito effectively represents a monad purely because as you tried to allude to, a monad is not just about the fact that it is a wrapped time but about what functions are available to it.

Imagine a list with no map, is it really a monad?

https://swlaschin.gitbooks.io/fsharpforfunandprofit/content/...

That whole series is a great breakdown of functors and monads that really opened my eyes. This is near the end but that also means all the links are available.

Re:A Burrito Is a Monad by bazoom42 on Tuesday October 01, 2024 @06:33AM (#41706631)
> The IO monad, just like the state monad is still just a type wrapping another thing... In those cases, it is wrapping side-effects.

Side effects are not a type though. The “type wrapping another type” in the parent refers to List T and Maybe T where T is the wrapped type. But with IO you can have IO String or IO () representing operations with side-effects, so the analogy breaks down.

A common problem with half-baked monad explanations is they generalize from one or two monads and then create an analogy which breaks down for other common monads.