89 karma · joined Jan 4, 2017 (9y ago) · 13 submissions
comment 1y ago · link · parent
comment 2y ago · link · parent
One must consider the cost of developing/maintaining new language parsing infrastructure (main point of the blog) against the readability/conciseness/features of a new syntax (not discussed in the blog).
3.
Distributed Patch Dissemination
1 points · by charmonium · 3y ago · discuss
5.
Stop Writing Shell Scripts(samgrayson.me ↗)
5 points · by charmonium · 5y ago · 4 comments
comment 7y ago · link · parent
comment 7y ago · link · parent
We can have arbitrarily nested monads:
monadicObj.bind((T value) => monad.wrap(monad.wrap(value)));
Remember, `bind` only unwraps one layer. Without it unwrapping one layer, programs would continue accumulating large stacks of monads in monads.I would also point out that it only collapses abstractions of the same kind; Maybe's bind only unwraps one layer of Maybe's. If you have a Promise<Maybe<Foo>> where Foo contains potentially more monads as instance-variables, those don't all get collapsed.
I like the 'converting nesting to concatenating' observation.
Sometimes we do need parentheses though, because most languages are not associative 5 - 2 - 1 is not the same as 5 - (2 - 1). Basically minus does not form a monoid, so the parens matter.
comment 7y ago · link · parent
An object wrapper has to have the object somewhere in memory, you just can't touch it. With a monad, the object might not even exist yet (example: Promise) or there might be more than one (example: Collections).
comment 7y ago · link · parent
10.
Monads as a Programming Pattern(samgrayson.me ↗)
233 points · by charmonium · 7y ago · 80 comments
comment 9y ago · link · parent
comment 9y ago · link · parent