News for hackers. Stuff that matters.
Re:Functors and Monads for People Who Have Read Too Many “Tu... by bcrosby95 on Saturday June 26, 2021 @02:20AM (#27639611)
Because most people suck at taking abstract mathematical concepts and seeing how they could apply to code. Including me. Let's take the definition of a function:

> A function is a relation for which each value from the set the first components of the ordered pairs is associated with exactly one value from the set of second components of the ordered pair.

Cool, I have no idea what the fuck this means and how it is useful to me.

Oh wait, I use them every day.

Re:Functors and Monads for People Who Have Read Too Many “Tu... by hiker on Saturday June 26, 2021 @04:37AM (#27640221)
> Cool, I have no idea what the fuck this means and how it is useful to me.

> Oh wait, I use them every day.

Do you really? Do the `functions` you use even fit the above definition?

I bet you can think of infinite number of functions (bool -> bool). The above definition admits only 4 such functions.

Re:Functors and Monads for People Who Have Read Too Many “Tu... by bb010g on Saturday June 26, 2021 @05:33PM (#27646093)
There are only 4 (2**2) such pure functions. For type (Bool -> IO Bool), there are infinite (∞**2) such pure functions.
Re:Functors and Monads for People Who Have Read Too Many “Tu... by siraben on Saturday June 26, 2021 @02:32AM (#27639652)
That is the first definition stated in first-order logic, sure. But the operational reading of a (computable) function being something that takes in input and produces an output (via some algorithm) is still correct. It is possible to be both clear and correct with operational analogies. However, monads and functors don't readily admit an easy operational reading like functions.