Live data from Hacker News

Learn You a Haskell for Great Good

learnyouahaskell.com

11–20 of 67 posts

Re: Learn You a Haskell for Great Good

#11
post #7

Is the name of this book some sort of inside joke or something?

It is a gamer|anime|comic book joke. There is a lot of cheaply written entertainment with poorly defined motivations ascribed to the heroes and villains. So what battle cry is used by an overly generic hero? Why an overly generic cry of "For great justice!" of course. Throw in a joke a about poor translations and you get their title.

Re: Learn You a Haskell for Great Good

#12
post #3

This is an amazing book. I highly recommend it as the first Haskell book you read. After it, you can check out Real World Haskell. To elaborate on why you shouldn't read (at least the online version of) Real World Haskell first: It has a lot of important topics that it covers that LYAH does not cover (like how to use cabal their package manager). But, it's not as good of a tutorial on the language and functional prog…

I started reading the online version, enjoyed it so much, I went ahead and boug ht the treeware version. And it's awesome.

I felt so loved as a customer of No Starch Press. They sent me the book, let me download the ebook in three free formats (no DRM), plus I got a bunch of freebie stickers.

The book itself is also quite remarkable to me in that I can read it and understand Haskell without needing a computer. I am used to reading mathematics books, and while I don't think Haskell is a programming language for all mathematicians as is so often advertised, the language does have a certain appeal to it in that you can treat its programs as abstract exercises that you can do independently of a machine. The statelessness of the whole thing doesn't need me typing stuff into a machine to see what a particular line of code. This makes it great for offline reading, away from the computer.

So yeah, get the treeware version. Support your favourite authors. :-)

Re: Learn You a Haskell for Great Good

#13
post #5

Haskell looks very interesting but I can't help but ask 'why do I need it?'. Currently I am learning Java since I want to get a jr.developer job later on and Ruby for some scripting and personal projects(maybe even Rails later). So Java is used in industry, Ruby is used in web and metasploit/ronin (something that I like to mess with), but what about Haskell? I am genuinely curious what Haskell can offer. I always see…

...to expand on other answers - I encourage you to ask the same question, but about Lisp (Scheme, Clojure) =)

Re: Learn You a Haskell for Great Good

#15
post #5

Haskell looks very interesting but I can't help but ask 'why do I need it?'. Currently I am learning Java since I want to get a jr.developer job later on and Ruby for some scripting and personal projects(maybe even Rails later). So Java is used in industry, Ruby is used in web and metasploit/ronin (something that I like to mess with), but what about Haskell? I am genuinely curious what Haskell can offer. I always see…

From the perspective of "learn other languages to broaden your horizons":

Haskell is worth learning because it has an expressive, strong, static type system. Most other languages do not have that property (Java's type system is static, give or take null, and strong, but not expressive, and Ruby's is strong but neither expressive nor static). The Haskell type system lets you have conversations with the compiler about what your program should do.

You can declare a state type, and have the compiler tell you if you switch on the state and forget to handle one of the possible states (or if you add a state later and forget to update all the switches).

You can tell the compiler "I think this function is a generally useful utility function that I plan to extract out of this project and use elsewhere", and it will tell you whether there's some dependency on your project that you missed.

You can specify in a function's type "this function should have access to the database"; then the compiler can tell you if you're trying to access the database somewhere you didn't expect to. (A colleague has just spent a person-year of effort refactoring a Django web app, because all the database calls were happening in the view code, and they needed to abstract them out to scale.)

Of course there are ways to do some of those things in other languages, and of course there are also downsides to the static type system. But those sorts of abilities open up new programming techniques (even in languages with poorer type systems), and have shown me ways programming can be better.

Re: Learn You a Haskell for Great Good

#16
post #7

Is the name of this book some sort of inside joke or something?

The author is a very funny/insane guy. Exhibit A is his twitter account (https://twitter.com/bonus500). I wouldn't call it an inside joke, but rather a general feature of good comedy where it feels familiar yet distant.

Re: Learn You a Haskell for Great Good

#17
post #5

Haskell looks very interesting but I can't help but ask 'why do I need it?'. Currently I am learning Java since I want to get a jr.developer job later on and Ruby for some scripting and personal projects(maybe even Rails later). So Java is used in industry, Ruby is used in web and metasploit/ronin (something that I like to mess with), but what about Haskell? I am genuinely curious what Haskell can offer. I always see…

> I always see it mentioned on Reddit but I have yet to come across any notable project written with it.

xmonad, one of the best tiling window managers for Linux, is written in Haskell (and is open source).

Re: Learn You a Haskell for Great Good

#18
post #5

Haskell looks very interesting but I can't help but ask 'why do I need it?'. Currently I am learning Java since I want to get a jr.developer job later on and Ruby for some scripting and personal projects(maybe even Rails later). So Java is used in industry, Ruby is used in web and metasploit/ronin (something that I like to mess with), but what about Haskell? I am genuinely curious what Haskell can offer. I always see…

> 'why do I need it?'

For the same reasons you need any programming language—to write useful software in!

> Currently I am learning Java…and Ruby

These are both good ideas. Java is widely used, reliable, and well tested for developing large applications. Ruby is simply a lot of fun to use, and one of the things you’ll discover while using Ruby is that it places a lot of functional programming idioms in an object-oriented context.

The issue with many popular languages is that they fall into much the same paradigm, namely imperative and either procedural or object-oriented, with some functional features borrowed for working with lists. It’s worthwhile to see that not all languages are like this, and learning a new language is not just about new syntax and APIs.

> but what about Haskell? I am genuinely curious what Haskell can offer.

Haskell will teach you to think about structuring your program in terms of simple data and transformations on that data. Object-oriented programming is about coupling data with behaviour, whereas a big part of learning Haskell is learning how to recognise high-level patterns in data structures and functions separately. In doing so, you can avoid the work of reimplementing common operations yourself.

You begin to say, oh, this is a data structure I can map a function over; I’d better make it an instance of Functor. And hey, I could use this data structure to represent this kind of computation, maybe it should be an Applicative and a Monad so I get some nice syntax for dealing with it. This function has a type signature that looks an awful lot like that other type signature—I wonder if I could implement one in terms of the other? And so on.

The type system and succinct syntax also make it very easy to create new data types, and you learn how this can help avoid bugs—don’t use a Boolean here, use an enumeration with two values; then you can’t mess up. Java discourages this by requiring more syntactic effort to create a new datatype.

A useful and oft-cited example of this is in the context of web frameworks: if you have separate data types for strings and HTML, that one simple thing eliminates a whole class of injection attacks. If you represent your links in the type system, then you can statically ensure that your site does not have any broken links. Simply put, quite a lot of bad things can be caught at compile time if you have a type system expressive enough to talk about them.

> I have yet to come across any notable project written with it.

There are more notable projects out there, but here’s my self-promotion. At my old job[1] I maintained a compiler for ActionScript 3 in Haskell, as well as a build system that coordinated the compiler and other build tools to convert Flash games to iOS and Android applications.

Haskell is excellent at manipulating data structures—if that sounds ridiculously general, that’s because it is. The compiler is very nearly feature complete and, even with a certain amount of technical debt, was an order of magnitude smaller and easier to refactor than it would have been in an imperative language.

So there you go. From a recovering professional Haskeller, why you should learn Haskell. And, for that matter, the answer to “should I learn this language?” is always “yes”; but some languages should be higher on your list than others. ;)

[1]: http://spaceport.io/

Re: Learn You a Haskell for Great Good

#19
I'll reccomend Erik Meijer's videos on introductory Haskell. I haven't gotten though them all but I appreciate his style and depth of knowledge on the matter; he also points out many things that a Java or C# dev would naturally be curious about how to interpret Haskell.

http://channel9.msdn.com/Series/C9-Lectures-Erik-Meijer-Func...

Post reply on HN