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.

Which monads Haskell developers use: An exploratory study

89 pointsby paulcareyover 4 years ago

3 comments

sirabenover 4 years ago
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 未加载
lmmover 4 years ago
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 未加载
jakubobozaover 4 years ago
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 未加载