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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Effectful Haskell: IO, Monads, Functors

84 点作者 brassybadger超过 9 年前

7 条评论

nilved超过 9 年前
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 未加载
imh超过 9 年前
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>
bshimmin超过 9 年前
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 未加载
jtaylor100超过 9 年前
This article has successfully caused me to understand what a monad is.
lobster_johnson超过 9 年前
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 未加载
heroku超过 9 年前
&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 未加载
aikah超过 9 年前
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 未加载