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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Which monads Haskell developers use: An exploratory study

89 点作者 paulcarey超过 4 年前

3 条评论

siraben超过 4 年前
Haskeller here, some observations:<p>- Not surprised that the state monad is the most commonly used one, it essentially acts as an escape hatch to write more imperative-looking code<p>- List monad least used, probably due to the fact that Haskell has list comprehensions<p>- Continuation monad is second least used, much like how many programmers find Scheme&#x27;s call&#x2F;cc unintuitive, continuations can be complex conceptually and have specific use cases that don&#x27;t really appear in industry<p>- The Error monad in mtl has been deprecated in favor of Except, looks like there&#x27;s still many packages left to update<p>Overall I&#x27;d say that mtl has penetrated quite well into the Haskell community, any intermediate Haskeller likely knows it. However, I hope that in the future more people end up using effect libraries such as fused-effects and polysemy (based on the work on extensible effects[0]) which have compositional and performance advantages.<p>Also, one common complaint from the effects community is how the IO monad is a &quot;sin bin&quot; (as SPJ describes it) of effects. One ought to be able to express more nuanced side effects such as network&#x2F;disk access or console I&#x2F;O.<p><i>When designing a program we should start thinking what effect we want to achieve rather than which monad transformer to use. Instead of jumping straight to StateT and so on, we ought to identify what transformation on the world and its resources we wish to effect.</i><p>[0] <a href="http:&#x2F;&#x2F;okmij.org&#x2F;ftp&#x2F;Haskell&#x2F;extensible&#x2F;" rel="nofollow">http:&#x2F;&#x2F;okmij.org&#x2F;ftp&#x2F;Haskell&#x2F;extensible&#x2F;</a>
评论 #24502185 未加载
评论 #24508805 未加载
评论 #24503873 未加载
lmm超过 4 年前
A big advantage of the monad abstraction is that you can define custom monads to suit your business cases, but then reuse a lot of existing functionality with those monads. So looking at which &quot;standard&quot; monads are most popular only tells half the story.
评论 #24503616 未加载
jakuboboza超过 4 年前
I used most commonly IO and State monads.<p>but I didnt write any Haskell code for like 4 years now. So stuff could change. Maybe GHC got fixed ;)
评论 #24503949 未加载