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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Pedagogical Downsides of Haskell

74 点作者 scscsc大约 2 年前

13 条评论

yamtaddle大约 2 年前
I find its syntax &amp; idiomatic style incredibly difficult to follow, in a way nearly no other languages have been for me, including some functional languages (OCaml doesn&#x27;t seem nearly as bad to me, for instance).<p>It&#x27;s sometimes implied that those who trip over Haskell just aren&#x27;t big-brained enough to understand various important concepts related to it, but I&#x27;ve found they&#x27;re usually very easy to grasp, provided the explanation&#x27;s not using Haskell examples. If all programming were Haskell, I probably never would have become a programmer in the first place. Would have taken me too long to figure any of it out, probably would have concluded I wasn&#x27;t smart enough to be a programmer.<p>I do wonder if there are some shared experiences or common patterns to who tends to love Haskell, and those who don&#x27;t. I also feel nigh-dyslexic trying to read math formulas. Human language and broadly C-family programming languages, on the other hand, seemed easy and natural to me, almost effortless to pick up. Wonder if there&#x27;s a &quot;mathy&quot;-person versus &quot;languagey&quot;-person divide on finding Haskell legible.<p>I&#x27;m not sure it&#x27;s the whole thing, but I think I&#x27;ve also figured out that I find algorithm-type reasoning far easier to follow and work with than equations or proofs. Like, the only way I can begin to get traction with an unfamiliar equation is to break down what each term and operation &quot;does&quot; to something &quot;moving through&quot; it—it&#x27;s tedious as hell. Might be something there.
评论 #35559104 未加载
评论 #35559190 未加载
评论 #35559528 未加载
评论 #35558976 未加载
评论 #35581612 未加载
评论 #35559311 未加载
评论 #35565908 未加载
javajosh大约 2 年前
The pedagogical downside of Haskell is that it ignores the physical reality of the machine. Physically, a computer is imperative, has mutating state, and is filled with all kinds of possible race conditions. Even after you apply the operating system, allowing processes to live together (and giving you space to define new ones), very few constraints are placed on your program and process space.<p>Instead of building on this reality, Haskell asserts that the starting point is not physical reality, but rather a mathematical formalism called &quot;The Lambda Calculus&quot;, the physical machine is looked at with disdain and pity, its limitations to be worked around to provide the one true abstraction. This is the original sin of Haskell, because it is an attitude that isn&#x27;t driven by a need to make a thing, but aesthetics and a peculiar intellectual dogma around building that ultimately becomes a stumbling block.<p>In my view, you <i>have</i> to respect the machine. Abstractions can be beautiful, but they are ephemeral, changeable, unreal. The danger is that these illusions become a siren song to makers who are always looking for better tools, and to these makers the abstractions become realer than the machine. Haskell&#x27;s power users famously don&#x27;t actually make anything with it (modulo pandoc and jekyll), and my guess is because either they find that 90% of real-world things you want to do are &quot;ugly&quot; from Haskell&#x27;s point of view, and so are left as distasteful &quot;exercises for the reader&quot;, or they get so distracted by the beauty of their tools they never finish.<p>In any event, Haskell is a road less traveled for good reason.
评论 #35558486 未加载
评论 #35559855 未加载
评论 #35558952 未加载
评论 #35558857 未加载
评论 #35558608 未加载
评论 #35558469 未加载
评论 #35562676 未加载
评论 #35558517 未加载
评论 #35559017 未加载
评论 #35559432 未加载
评论 #35558551 未加载
评论 #35581725 未加载
评论 #35565760 未加载
评论 #35578764 未加载
mrkeen大约 2 年前
Brilliant write up.<p>&gt; There is also a school of thought that you should start Haskell by teaching the IO monad first, but I am not convinced: in my experience, if someone gets exposed to IO early on, they will contaminate all their functions with IO. They will essentially end up writing Java in Haskell.<p>I don&#x27;t think this is such a bad starting place. Crawling before walking. Purifying an (unnecessarily-) IO function into an ordinary function is a good exercise.<p>Trying to enforce non-IO from the start would be like enforcing &#x27;no new keyword &amp; factories only&#x27; in another language.
评论 #35558427 未加载
评论 #35558414 未加载
评论 #35558672 未加载
评论 #35557907 未加载
mprovost大约 2 年前
This is great and a lot of it rings true to my experience writing a book to teach Rust. It&#x27;s basically a giant topological sorting exercise to find the optimal order to introduce syntax so that you steer clear of rabbit holes. Or you just end up drawing the owl.<p>For example, to implement a simple &quot;hello world&quot; program in Rust you have to use a macro (println!), so you can&#x27;t even look for a function signature in the standard library docs to help. So you can either just say &quot;don&#x27;t worry about this for now, just trust me&quot; or spend a whole chapter diving into macro syntax. The number of concepts you need to implement a basic program is pretty large and you could easily spend a chapter going into any of them.<p>Personally I&#x27;m not a fan of the approach in this post to just &quot;lie&quot; to people but I do find myself showing a non-optimal implementation because that&#x27;s all the syntax I&#x27;ve introduced up to that point. Then later I show how to do it better. I know some readers just want the final answer up front though.
评论 #35566809 未加载
agentultra大约 2 年前
I wonder if there could be a (or already is) a &quot;teaching&quot; Prelude designed for this purpose.<p>One of the reasons the standard Prelude includes partial functions and specialize versions of `map` and `filter` is to support the pedagogical use-case (as far as I understand the situation). Most production applications will use a custom Prelude of some kind in order to prevent programmers from using foot-guns like `head` or make things more general in the case of `map` and `filter`.<p>Turns out using linked-lists for everything isn&#x27;t the best idea but a lot of Haskell applications will use them because it&#x27;s in Prelude.<p>Bit of a balancing act supporting both use cases.
评论 #35560113 未加载
yakshaving_jgt大约 2 年前
I think Elm is second to none as a tool for learning FP.<p>It compiles quickly, the guidance offered in error messages are best in class, it&#x27;s small, and the mental model is consistent.<p>In fact I think it&#x27;s far easier to learn Elm (and also perhaps web UI development wouldn&#x27;t be such a shitshow if programmers earlier in their career used Elm to build their mental model) than it is to learn:<p>- React<p>- Redux<p>- Immutable.js<p>- Lodash&#x2F;Ramda<p>- ES${CURRENT_YEAR}<p>- Webpack&#x2F;Parcel&#x2F;Grunt&#x2F;Groan&#x2F;Whatever<p>- etc…<p>I&#x27;ve seen so many early programmers go through some React course thinking they&#x27;ve learned FP, and yet struggle to solve basic problems by applying functions to values.
tikhonj大约 2 年前
Code World[1] is a great project that addresses a number of the problems from the article, with an eye towards using Haskell to teach children basic math and programming simultaneously. Code World directly addresses a number of the obstacles outlined in this article:<p>1. Using an online editor with a rich built-in library removes any toolchain problems.<p>2. A custom standard library simplifies pedagogically unnecessary details like Foldable<p>3. The custom standard library also avoids currying (f(a, b) for functions rather than f a b)<p>4. Custom error messages improve the feedback students get from the compiler<p>I would highly recommend Code World to anybody looking to teach programming <i>with</i> Haskell. If you want to teach Haskell in a way that fits the existing ecosystem, it&#x27;s also possible to run Code World without the custom standard library[2].<p>[1]: <a href="https:&#x2F;&#x2F;code.world&#x2F;#" rel="nofollow">https:&#x2F;&#x2F;code.world&#x2F;#</a><p>[2]: <a href="https:&#x2F;&#x2F;code.world&#x2F;haskell#" rel="nofollow">https:&#x2F;&#x2F;code.world&#x2F;haskell#</a>
tome大约 2 年前
I find the go pattern absurd. Which of these is easier to read:<p><pre><code> foldr k z = go where go [] = z go (y:ys) = y `k` go ys </code></pre> or<p><pre><code> foldr k z = foldr_k_z where foldr_k_z [] = z foldr_k_z (y:ys) = y `k` foldr_k_z ys</code></pre>
评论 #35558625 未加载
评论 #35559035 未加载
评论 #35558722 未加载
asplake大约 2 年前
Point 11 surprised me. Not the “go” thing but the “where” syntax – I wish more languages had it!
评论 #35558544 未加载
评论 #35559278 未加载
jy14898大约 2 年前
PureScript might be worth considering, a few of the downsides listed here aren&#x27;t in PS, for example: Int&#x2F;Number primitives aren&#x27;t overloaded, strict evaluation, the various tools like package management are easy, explicit Prelude means you are free to import foldl from Array for example.<p>Of course PureScript has it&#x27;s own downsides not apparent in GHC
评论 #35558144 未加载
iamnotsure大约 2 年前
Had good experience at <a href="https:&#x2F;&#x2F;exercism.org&#x2F;tracks&#x2F;haskell" rel="nofollow">https:&#x2F;&#x2F;exercism.org&#x2F;tracks&#x2F;haskell</a><p>I don&#x27;t think this article is helpful for beginners.
评论 #35558494 未加载
deafpolygon大约 2 年前
For someone not familiar with functional programming (but familiar with OOP&#x2F;procedural), this was not easy or intuitive for me to follow.
FpUser大约 2 年前
I generally trying to avoid single paradigm languages that are trying to show me the one and only &quot;true&quot; way. I see no business benefits coming of of their use.