News for hackers. Stuff that matters.
Re:Serotonin booster leads to increased functional brain con... by LoganDark on Wednesday June 14, 2023 @11:31AM (#36327469)
AIUI, an "endofunctor" is just a function that returns the same type as its input, and a "monoid" is one that has an "identity element" (that isn't part of the arguments). So what that's saying is basically "a monad is a function that takes a single argument and then returns the same type as that argument". Which is not a terrible take, though extremely simplified.

In practice monads are "functors", not "functions", which basically means a monad represents the set of possible operations you can perform, which is why objects/structs can be monads (because you call functions on them to perform those operations, i.e. the object you can call those functions on represents the operations that can be performed by those functions).

As a result, monads in practice usually have some collection of fundamental operations that make them useful (looking at Rust's `Option`[0] might be enlightening), like map, join (flatten), etc.

[0]: https://doc.rust-lang.org/stable/std/option/index.html

There are no comments on this comment yet.