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.

Effectful Haskell: IO, Monads, Functors

84 pointsby brassybadgeralmost 10 years ago

7 comments

nilvedalmost 10 years ago
Naming is one area where Haskell's academic background is more curse than blessing. Numerous tutorials and blog posts would never have been written if only functor was named mappable and monad was named computation builder. They're named by analogy to category theory, but their usage in computer science is not at all similar.
评论 #10140456 未加载
评论 #10141094 未加载
评论 #10140603 未加载
评论 #10141323 未加载
评论 #10141372 未加载
评论 #10140594 未加载
评论 #10141122 未加载
评论 #10140452 未加载
评论 #10140689 未加载
评论 #10140430 未加载
imhalmost 10 years ago
Here&#x27;s the next article in the series:<p><a href="http:&#x2F;&#x2F;slpopejoy.github.io&#x2F;posts&#x2F;Effectful02.html" rel="nofollow">http:&#x2F;&#x2F;slpopejoy.github.io&#x2F;posts&#x2F;Effectful02.html</a>
bshimminalmost 10 years ago
I was interested and pleased to note that the source for this post is available in Literate Haskell: <a href="https:&#x2F;&#x2F;github.com&#x2F;slpopejoy&#x2F;tatterdemalion&#x2F;blob&#x2F;working&#x2F;posts&#x2F;Effectful01.lhs" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;slpopejoy&#x2F;tatterdemalion&#x2F;blob&#x2F;working&#x2F;pos...</a>
评论 #10163383 未加载
评论 #10163382 未加载
jtaylor100almost 10 years ago
This article has successfully caused me to understand what a monad is.
lobster_johnsonalmost 10 years ago
Something I&#x27;ve wondered about: How does Haskell not optimize away IO ()? In a pure, functional languages, a function that doesn&#x27;t return anything can simply be eliminated — but of course it isn&#x27;t.<p>I&#x27;ve always assumed that Haskell&#x27;s compiler has a built-in rules about IO having side effects, but I never actually bothered to find out.<p>When I first started with Haskell, one of many small epiphanies was when I realized that the IO monad itself doesn&#x27;t actually <i>do</i> anything. bind and return don&#x27;t do anything except wrap and unwrap values, and there&#x27;s nothing that checks if you are in some kind of &quot;IO context&quot; to permit things like file I&#x2F;O. There&#x27;s no magical &quot;side-effectful computation chain engine&quot; behind the scenes.
评论 #10141679 未加载
herokualmost 10 years ago
&quot;We can see therefore how Monad offers strictly more powerful transformations than Functor. fmap can only transform an individual value “in place”, while &gt;&gt;= can return an empty list, or a list with more elements than the original. Functor is “structure preserving”, while Monad is “structure transforming”.&quot;<p>So for a list monad bind = flatMap fmap = map<p>is that correct?<p>Studying FP for quite a while first monad tutorial I come to fully understand finally.
评论 #10140945 未加载
aikahalmost 10 years ago
So is it possible to explain monads with Javascript ? or even LISP ? seems to me monads == haskell so if one doesn&#x27;t understand haskell one can&#x27;t understand monads , cause all monad tutorials are written in haskell. So I ask , what is the point of learning what a monad is if i&#x27;m writing some Java ?
评论 #10140550 未加载
评论 #10140560 未加载
评论 #10140749 未加载
评论 #10140555 未加载
评论 #10140498 未加载
评论 #10140565 未加载
评论 #10140663 未加载
评论 #10140598 未加载