Live data from Hacker News

What was your "ah ha" moment with Haskell?

reddit.com

31–40 of 61 posts

Re: What was your "ah ha" moment with Haskell?

#31

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.

I trust that you've read the excellent essay "And then there's Haskell..."

http://www.xent.com/pipermail/fork/Week-of-Mon-20070219/0441...

(Edit: After further research if you were on Hacker news mid january last year this would in fact be old news, sorry for the unwitting repost)

Re: What was your "ah ha" moment with Haskell?

#32
post #8

Earlier quoted context omitted.

Then I would be interested about your opinion on OcaML/MLTon, F# and Scala. To me they seem like a good balance. If you are more adventurous then try Felix. EDIT: apparently someone did not like your comment. Some downvotes confound me.

Would that downvotes interested me... To your questions: OcaML: seems like a hack-ish [S]ML. There's a nice comparison between SML and OcaML here : http://adam.chlipala.net/mlcomp/ . I like SML's syntax, but OcaML made it too easy to be imperative and seemed too hackish. Most of the OcaML I've seen looks like weird C, but written in OcaML because it's F4ST3R. F# : I run Linux... next! Scala* : I can't stand it. I use…

     [Scala] Type inferencing, but not powerful type inference?
In Scala the Hindley–Milner type inferencing is not possible because Scala is OOP, compared to Haskell which isn't.

Ocaml does have Hindley-Milner, but not for the OOP features and whenever I played with Ocaml it felt like 2 different type-systems shoved into the same language (much like Obj-C). Scala on the other hand is more consistent, elegant and simpler. That's why it has "case classes", because case classes are used for algebraic data-types, which have special properties that aren't necessarily shared by normal classes.

And because of implicits, the type-system is also more powerful than what's available in Ocaml and even Haskell. It's arguably too powerful, but the things that the collections library can do have no match in other languages. E.g. http://stackoverflow.com/a/1728140/3280

I also liked to bitch and moan about the lack of real type inferencing in Scala, however in Ocaml and Haskell just because the types are not specified, that doesn't mean you can ignore those types. Quite the contrary, you always have to be aware of those types, as opposed to working in a dynamic language. That's why it's standard practice in Haskell to add those types explicitly for public APIs, because otherwise it hurts readability a lot.

Re: What was your "ah ha" moment with Haskell?

#33
post #27
post #20

Earlier quoted context omitted.

In my experience, Haskell is not yet a great language for numerically intensive computing. I'll explain in a bit, but before I do, let me first address your question about "can I bang on bits?". Yes, you can allocate memory and do all the low-level hacking you please in Haskell. It's not really any harder than in C, although the notation is different and that throws people. But because this is a very imperative way o…

> There are interesting projects underway for parallel programming (both on CPUs and GPUs) that rely heavily on the type system Are you referring to Accelerate[1]? And isn't Repa[2] stable and usable? [1]: https://github.com/AccelerateHS/accelerate/ [2]: http://repa.ouroborus.net/

Unfortunately, repa and vector are sometimes a few times slower than counterparts in C or C++ for the lack of SIMD intrinsics. Thankfully, things are moving forward fast on that front:

http://ghc-simd.blogspot.com/

Re: What was your "ah ha" moment with Haskell?

#34
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:

    do
      x 
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 x 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 :).

Re: What was your "ah ha" moment with Haskell?

#36

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. :)

Reading won't get you anywhere unfortunately.

The ingenuity of Haskell is doing, writing code. You'll have many 'ah-ha!' moments after that.

Also I think the major problem with Haskell is A LOT of the online content out there is primarily aimed at academia and quite honestly baffles me too.

If you stick with LYAH and RWH and...just doing code then it becomes a lot more usable and fun to program in

Re: What was your "ah ha" moment with Haskell?

#37

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.

> I realized that it wasn't actually making me more productive in the kind of code I actually write from day-to-day

I've got a quip for that in my quotefile:

> "Haskell mainly helps with my C++ template coding when I'm doing money oriented programming" -- fnord123

Re: What was your "ah ha" moment with Haskell?

#38
post #8

Earlier quoted context omitted.

Agreed. It's so beautiful, but so constraining. I'm a much better developer for having used it, but returned to Python/Ruby/Java[for-speed] after spending lots of time with Haskell. That said, I desperately miss static-typing and Hindley-Milner type inference... I keep searching for the perfect language.

Then I would be interested about your opinion on OcaML/MLTon, F# and Scala. To me they seem like a good balance. If you are more adventurous then try Felix. EDIT: apparently someone did not like your comment. Some downvotes confound me.

I'm sure any downvotes he got (I didn't moderate) was due to his making a fairly strong, and fairly objective claim -- Haskell is constraining -- without saying why it was constraining or even elaborating in what manner it was constraining.

Re: What was your "ah ha" moment with Haskell?

#39

Off topic, but my "ah ha" moment with both Clojure and Lisp was this blog post by John Lawrence Aspden: http://www.learningclojure.com/2010/09/clojure-faster-than-m... 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 ther…

[deleted]
Post reply on HN