You Don't Need Monads
muratkasimov.art
muratkasimov.art
- η[i]: i → t i: this is return/pure.
- μ[i]: t (t i) → t i: this is join.
Now conform to the coherence conditions (aka the monad laws), and you have ... a monad. So why not call it that? It's convenient to have a name for it, and nothing stops you from passing around return/join as freestanding natural transformations if you really want to.
Show me the behaviour of a State/Either stack!
As far as I can tell, these natural transformations are equivalent to the type class instances required for monad transformers. You need some way to transform a computation in a component monad to a computation in the composed monad.
There's three combinations of World, State, and Stop expressed, with natural transformations for each specific effect within each combination, ie, "lift" for each part to the composed whole. Those particular effects don't sensibly compose any other way than the ones given: there's no (reasonable) interpretation of State of Stops, only for Stops of State, and no reasonable interpretation of World that isn't "on the inside", much like in mtl one always puts IO at the bottom of the stack.
If we had an Error effect, though, maybe we'd want to interpret errors within stateful computations and retain the state, maybe we'd want to interpret errors outside the stateful computation and abort the whole thing...
But sure, in an effects-based system you'd preferentially use effect composition over monads, and sure, monad transformers is an n^2 problem, but sadly natural transformations between functors obeying certain laws is also an n^2 problem.
I think. I do admit to getting lost on what the different squiggles mean, quite a lot.
This is the most arcane codebase I've seen. It's on par with co-dfns compiler. The frontend syntax also looks like a cross between Haskell and APL.
Is that some kind of meme I don't understand?
I mean, it kinda looks like all the combinations of a bunch of operators that can be combined.
It's, like, an ideographic alphabet
https://muratkasimov.art/Ya/Operators explains a bit
The problem is, it explains in a language for people that know category theory, rather than people that merely use functors, applicatives and monads in Haskell
Indeed we could say that those programming interfaces don't need a lot of category theory to understand. For example, in Java a functor would be called Mappable (and actually it seems there is such a thing defined in some libs)
We need a poor man's interface to generalise them, as well as suitable poor man's laws to abide by, and pretty soon we'll have some sweet poor man's code re-use!
(Nod to https://stackoverflow.com/questions/2497801/closures-are-poo... yet real question.)