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 was your "ah ha" moment with Haskell?

116 pointsby donsalmost 13 years ago

15 comments

supersillyusalmost 13 years ago
My "ah ha" moment with Haskell was after a few years of using it quite regularly, I realized that it wasn't actually making me more productive in the kind of code I actually write from day-to-day. It's a lovely language and I wouldn't discourage anyone from using it, but for my purposes I realized it was more exciting than useful at some point, and after that I haven't been back to it as much.
评论 #4154675 未加载
评论 #4155929 未加载
评论 #4154544 未加载
评论 #4155625 未加载
lkrubneralmost 13 years ago
Off topic, but my "ah ha" moment with both Clojure and Lisp was this blog post by John Lawrence Aspden:<p><a href="http://www.learningclojure.com/2010/09/clojure-faster-than-machine-code.html" rel="nofollow">http://www.learningclojure.com/2010/09/clojure-faster-than-m...</a><p>He managed to get a statement to go as fast the JVM could possibly go, and he did this by getting the code to write code (the code added type castings to every variable, which apparently gave the JVM the info it needed to optimize like crazy). And there is no way to do that without hard-coding, and if you don't know what kind of data you are going to get, then obviously there is no way to hard-code anything. In other words, this kind of stunt can only be done in a language that allows this kind of code-that-writes-code.
评论 #4156110 未加载
评论 #4156483 未加载
danieldkalmost 13 years ago
There were far to many 'ah ha' moments. So, I'll take one that I don't hear too often ;). Suppose that you are working on FFI code:<p><pre><code> do x &#60;- malloc poke x myCDouble return x </code></pre> My C reflex was: 'I have to specify how much memory I want to allocate, but malloc doesn't take an argument, what the heck?'. Obviously, since Haskell has proper type inference, it can deduce that <i>x</i> is a pointer to a CDouble, and has no trouble allocating the proper amount of memory. But for a moment I was thinking it can read my mind :).
jiggy2011almost 13 years ago
I studied haskell at university, but there was very little explanation of why it would be useful or the fundamental difference between it and a standard iterative language (or maybe there was and I skipped that day).<p>At that point I assumed it was simply a language invented by academics in order to torture undergrads.<p>It wasn't until a bit later and playing around with things like python and Javascript and using closures/lambdas that I realized I could use some of the functional ideas I had drilled when doing haskell to write simpler code.<p>Now when I go back to Java I often get frustrated and the amount of code I have to write simply to work around the fact that functions are not first class objects.
评论 #4154794 未加载
neutronicusalmost 13 years ago
I have yet to have my big ah-ha moment for how to do what I do (scientific computing) in Haskell.<p>I recently found myself needing a proof-of-concept implementation for solving a bunch of big tridiagonal matrices in parallel using MPI. I thought to myself "here's an opportunity to use Haskell!", but I must confess I'm rather stumped for how one goes about allocating some memory, banging on it, communicating a subset of it to another processor(s), reading a buffer from the other processor, and then banging on the memory I allocated before some more based on what I got back from the other processors(s).<p>Does one actually attempt to control the machine with this level of granularity with Haskell? Can one actually get any mileage out of the type system doing this sort of thing? Or am I just trying to fit a square peg in a round hole?
评论 #4155116 未加载
opminionalmost 13 years ago
The first example of parametric polymorphism, as introduced by a good teacher.<p>I wasn't even attending the class proper, but taking notes for a deaf student as a paid job.
flink127almost 13 years ago
My "ah ha" moment with Haskell was when I ragequit for the 23rd time and decided that Haskell is probably not for me.
评论 #4154877 未加载
sordinaalmost 13 years ago
I didn't have a single "ah ha" moment, but things became much clearer when I realised that although it was possible to have heterogeneous collections through the use of type-classes, what I nearly always wanted was to create a new data type with a constructor for each behaviour I was interested in encompassing.<p>The fact that data-types are so cheap, both syntactically and computationally, really frees you up from having to worry about not creating them. I did go too far the other way for a while and created new types for everything. There exists a happy middle ground, but it's hard to define where exactly it lies.
jamesbrittalmost 13 years ago
I was converting a somewhat complex Haskell example into Ruby for a presentation and kept running into neat concise Haskell expressions that I could not easily express in Ruby.<p>It got me thinking that Haskell might be a better Ruby.
cluxalmost 13 years ago
Reading the blow your mind wiki was ah ha overload. <a href="http://www.haskell.org/haskellwiki/Blow_your_mind" rel="nofollow">http://www.haskell.org/haskellwiki/Blow_your_mind</a>
shriphanialmost 13 years ago
I really like this:<p>twoK=1:(map (2*) twoK)<p>I still have a long way to go though - I can't write a lot of it without getting stuck and giving up. It would be really nice if I was comfortable with haskell.
vitomdalmost 13 years ago
My ah ha moment was when I found this tutorial <a href="http://learnyouahaskell.com/" rel="nofollow">http://learnyouahaskell.com/</a> , because was really fun and I learned a lot. Before, I was trying to learn from this: <a href="http://www.haskell.org/tutorial/" rel="nofollow">http://www.haskell.org/tutorial/</a> and was so boring that I almost quit
meowzeroalmost 13 years ago
It wasn't Haskell but another functional programming language (scala). I got my major "ah ha" moment when I did a code review with another experienced functional programmer. It showed to me that functional programming is a different paradigm.
tonethemanalmost 13 years ago
Ha already been said, but my ah ha came when after reading quite a bit about it. I realized I was incapable of understanding it and moved on. :)
评论 #4155860 未加载
评论 #4158366 未加载
verroqalmost 13 years ago
Learn Haskell to see how things could be done. Don't use Haskell for things that should be done.