TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Haskell: Monoid (Use Case Example)

3 点作者 cstml大约 4 年前

2 条评论

linkdd大约 4 年前
Haskell is nice, it&#x27;s type systems allows the developer to prove the properties of their algorithm.<p>But it&#x27;s so hard to read when you&#x27;re not used to the syntax, compare this to a Javascript&#x2F;Typescript solution:<p><pre><code> const conds = [ i =&gt; i % 2 === 1, i =&gt; i % 4 === 0, i =&gt; i % 6 === 0 ] [1, 2, 3].map(i =&gt; conds.every(f =&gt; f(i))) </code></pre> Any developer with any language background should be able to understand this.<p>But `foldl1 (||) (map ($x) tests)` is gibberish when you don&#x27;t know the Haskell syntax.<p>Maybe that&#x27;s why the entry level to Haskell is so high.
评论 #27104760 未加载
评论 #27113609 未加载
cstml大约 4 年前
I wrote this small post on a use case of the Monoid typeclass in Haskell.