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.

What I Wish I Knew When Learning Haskell

164 pointsby psibiover 11 years ago

9 comments

jrockwayover 11 years ago
Agree with the advice about monads. You&#x27;re going to think monads are weird because the first one you encounter is used to hide a particular detail of how Haskell works in the real world, namely that Haskell can&#x27;t mutate objects, but that running your program mutates the real world. Ignore this use case, because while interesting, it&#x27;s a messy implementation detail, not something to model in your own code.<p>Use monads for bailing out of computations early (Maybe&#x2F;Either) or passing some state along through a computation (State). When you&#x27;re comfortable with those concepts, look at ST for a generalization of what IO does. That is something you can actually use to simplify your own programs.
评论 #6868439 未加载
评论 #6868430 未加载
评论 #6868992 未加载
sillysaurus2over 11 years ago
Would someone please explain what a monad is and why they&#x27;re useful, in down-to-Earth, simple language that an engineer can appreciate?<p>I know (and use) basically every other CS concept. Monads, though, I&#x27;ve never bothered looking into, because it seems like everyone who talks about them can&#x27;t resist the urge to use flowery descriptions of their possibilities, rather than examples of their pragmatism.<p>Also, it&#x27;s suspicious that pg has never once mentioned monads: <a href="https://www.google.com/search?q=site%3Apaulgraham.com%20%22monad%22" rel="nofollow">https:&#x2F;&#x2F;www.google.com&#x2F;search?q=site%3Apaulgraham.com%20%22m...</a><p>If they&#x27;re useful, you&#x27;d think one of the best hackers would have said something about it. He spent a good deal of his career talking about closures, types, objects, functions, computing theory, lambda calculus, etc. But no monads.<p>So, are they useful? Would anyone please give examples of their usefulness?<p>EDIT: You know what&#x27;s worse than hero worship? Not being able to make a reasonable argument which uses someone as an example without being accused of hero worship.
评论 #6868529 未加载
评论 #6868560 未加载
评论 #6868825 未加载
评论 #6868748 未加载
评论 #6868636 未加载
评论 #6868657 未加载
评论 #6868788 未加载
评论 #6868543 未加载
评论 #6868534 未加载
评论 #6868599 未加载
评论 #6868660 未加载
评论 #6868894 未加载
评论 #6868700 未加载
评论 #6868725 未加载
评论 #6871298 未加载
评论 #6868957 未加载
jkremsover 11 years ago
I really wish people would start treating languages as languages. `(m &gt;&gt;= f) &gt;&gt;= g ≡ m &gt;&gt;= (\x -&gt; f x &gt;&gt;= g)` is <i>not</i> easy to understand because the symbols don&#x27;t have names. I can&#x27;t read it. How is &quot;m &gt;&gt;= f&quot; pronounced?
评论 #6868545 未加载
评论 #6868520 未加载
评论 #6868506 未加载
评论 #6868533 未加载
评论 #6868670 未加载
评论 #6868518 未加载
评论 #6868713 未加载
评论 #6868494 未加载
评论 #6868495 未加载
parallelistover 11 years ago
Anyone got any solutions for cabal hell? I barely use Haskell because 50%+ of everything I try to install fails and I don’t have a freaking clue how to fix it.
评论 #6868679 未加载
评论 #6868573 未加载
评论 #6868746 未加载
评论 #6871822 未加载
freyrs3over 11 years ago
It&#x27;s humorous that most of the article is <i>not</i> about monads, yet the entire discussion around it is about monads. Seriously, monads are only a small part of Haskell.
szanyover 11 years ago
<p><pre><code> SET : Group MAN : Lie Group TOP : Topological Group GRP : Objects </code></pre> The last line should really be &quot;GRP : Abelian Group&quot;<p>See <a href="http://en.wikipedia.org/wiki/Eckmann-Hilton_argument" rel="nofollow">http:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Eckmann-Hilton_argument</a>
codygmanover 11 years ago
As someone who has been learning haskell for the past 6~ months this is very valuable. I will be studying this and toying around with the examples quite a bit, thanks for this resource!
platzover 11 years ago
Not sure how I feel about this thread.<p>A hundred folks who probably haven&#x27;t investigated how to effectively teach adults, try to explain monads in the space of 3 tweets (probably not the best medium).<p>And then we wonder why folks steer towards less abstract tools. For every person who visits which gains monad satori, how many have we turned away, never to return?
ufoover 11 years ago
Holy shit how did I never know about the &quot;:r&quot; shortcut??? This changes everything.