TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Monads, or Programmable Semicolons (2014)

75 pointsby Pete_Dover 5 years ago

6 comments

lalaithionover 5 years ago
It saddens me that modern languages have basically implemented their own "monadic" syntax for specific cases without implementing something more generic. Rust, Kotlin, and Swift have `?` for the Option/Error monad, Javascript, C#, Python, and Rust all have `await` for the Promise monad. Both of these things and way more are possible with `<-` in Haskell, and while `do` notation isn't perfect, I'd really like another language that tried to build on that instead of doing ad-hoc syntax for the common cases.
评论 #21716736 未加载
评论 #21716462 未加载
评论 #21719643 未加载
评论 #21717198 未加载
评论 #21716629 未加载
评论 #21717865 未加载
评论 #21749459 未加载
评论 #21717803 未加载
评论 #21719039 未加载
评论 #21716937 未加载
评论 #21717215 未加载
评论 #21716623 未加载
评论 #21718937 未加载
评论 #21719041 未加载
foobar_over 5 years ago
Monads seem to be useful for ansync code and error handling. I hate that monads get all the press when ADTs are the real winner when it comes to FP.
评论 #21716687 未加载
评论 #21716841 未加载
评论 #21719590 未加载
ionforceover 5 years ago
Now that I&#x27;m on the side of &quot;I know what a monad is&quot;, let me just say 95% of what people say monads are is complete trash and unhelpful. This includes calling them &quot;semicolons&quot;.<p>I don&#x27;t think this analogy sets up anyone for success. For a long time now I&#x27;ve wanted to do a series on &quot;FP for OOP folks&quot;.
评论 #21719550 未加载
评论 #21719136 未加载
mbrodersenover 5 years ago
Monads are not &quot;Programmable Semicolons&quot;. I understand the thinking behind the statement but it really does a disservice to people who doesn&#x27;t know Monads using those kind of analogies.
评论 #21719640 未加载
评论 #21719221 未加载
mlazosover 5 years ago
I remember elsewhere on HN I got totally shat on for this analogy. The main case where this doesn’t apply is that monads can decide <i>whether or not to execute later computations</i> and that’s why it’s actually more general than a programmable semicolon. I think the programmable semicolon is more applicable to applicative functors than monads.
评论 #21720337 未加载
jclover 5 years ago
Why limit yourself to programmable semicolons? I hear C++ is going to have <i>programmable whitespace</i>: <a href="http:&#x2F;&#x2F;www.stroustrup.com&#x2F;whitespace98.pdf" rel="nofollow">http:&#x2F;&#x2F;www.stroustrup.com&#x2F;whitespace98.pdf</a>
评论 #21719769 未加载