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.

Haskell: Monoid (Use Case Example)

3 pointsby cstmlabout 4 years ago

2 comments

linkddabout 4 years ago
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 未加载
cstmlabout 4 years ago
I wrote this small post on a use case of the Monoid typeclass in Haskell.