Why not Haskell? (2011)

栏目: IT技术 · 发布时间: 4年前

At one point, I think I qualified as a Haskell ninja — I understood and used monad transformers, I had a bunch of modules up on the module sharing system including C bindings, I was even credited for providing feedback on a Haskell paper.

But I haven't done any of that in months, maybe a year. And much like my post-mortem about why I stopped looking at O'Caml in 2005 (which I think in part is what drove me to Haskell), I figure Haskell deserves one too.

First, the good: Haskell is truly beautiful. I cannot think of another thing I've played with that has been so mentally rewarding over such an extended period of time. It's permanently changed the way I think about programming, from computation all the way through aesthetics.

That sort of statement may also be true about e.g. Lisp but I found that there wasn't a whole lot to get about Lisp (that's kind of the point of Lisp, after all), whereas each extra month with Haskell gave me an extra month of new perspective on what it means to compute from type classes to laziness to combinators to, yes, monads. (Man, I feel like someone trying to explain what an acid trip is like.)

But despite all that experience, I conclude that writing Haskell code is hard. I don't mean that in the "math is hard, let's give up", sense, but that getting from an empty page to a program that does the job is a harder process than it is with e.g. Perl. A resulting correct Haskell program is likely more reliable, maintainable, and perhaps faster, but getting to that point (framing your problem the right way, knowing how to profile or deal with space leaks, understanding when unsafePerformIO is actually the right thing) is just too much effort.

Here's a diagram summarizing the problem:

Why not Haskell? (2011)

If you've written a Haskell program that runs, it's highly likely to be a correct solution; but the set of runnable Haskell programs is much smaller than the space of programs that get the job done, and frequently I'm more interested in being done.

I find myself digging up Haskell sometimes for when I want sketch something out mathematically: writing a program to answer a question like "how many different ways can I seat n people at m tables given these extra constraints?" is a delight in Haskell. But for the sorts of code I write, those parts are the small ones; the bigger ones are parsing file formats when the input language is not well specified or interacting with some grungy library.

(That point is the only point I wanted to make, but since there's nowhere else to shove it in, I'll add: I also recently dug up some old Haskell code I'd written in the past and found I was unable to compile it due to the "DLL hell" that is package versioning of Hackage. It made me grumpy.)

So, Haskell, I conclude: it was definitely worth my time, even if it had only been so I can understand PL research papers. I can wholeheartedly endorse you learning it as well. But I'm sad to say I don't imagine myself basing a new major project (or company) around it.

Strangely lately I've been writing a lot of code in Go, which seems to have attracted a lot of other people I know. I think of the Go language as sort of the anti-Haskell: visually ugly, semantically warty, written with apparently little regard for the state of the art in research — but on the other hand, incredibly pragmatic throughout. A shining example of worse is better.


以上所述就是小编给大家介绍的《Why not Haskell? (2011)》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

PHP 6与MySQL 5基础教程

PHP 6与MySQL 5基础教程

(美)厄尔曼 / 陈宗斌 等 / 人民邮电出版社 / 2008-11-1 / 65.00元

本书是一部经典的入门级著作,采用基于任务的方法来讲授PHP和MySQL,使用大量图片指导读者深入学习语言,并向读者展示了如何构造动态Web站点。书中用简洁、直观的步骤和讲解提供了学习任务和概念的最快方式。通过学习本书,读者可以快速、高效地掌握PHP和MySQL,成为一位构建Web站点的高手。 本书适合初中级Web应用开发和设计人员阅读。 本书是讲述PHP和MySQL技术的畅销书,以深入......一起来看看 《PHP 6与MySQL 5基础教程》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

随机密码生成器
随机密码生成器

多种字符组合密码