Hacker News new | past | comments | ask | show | jobs | submit login

Could you guys explain to me what Haskell would be mostly useful for. For instance, can it be used to make a web app backend or a GUI app? Or is it mostly for mathematical calculations and such. I tried to pick up Haskell once, but I guess I just couldn't get it. I mean, I got the core concepts, wrote a bunch of starter code, like prime checker and the like. But after going through several tutorial chapters, I still could not figure out how I would use Haskell in the real world.

I don't mean to criticize or anything, just mean to understand. There are so many people who are very passionate about Haskell that it makes me think that it must be worth while to learn. But I just don't get how it would be useful for things that I do most with programming: writing Web/Desktop/Mobile apps in Swift, Python, and PHP.

Also, can you recommend a good book or resource that uses real world examples to teach Haskell?

Haskell is a bit weird in that there are no niches where its a total killer-app and has the best libraries for everything. What its really good at is that it has a very solid type system and the core language is very clean, which encourages the use of powerful abstractions (for example: coroutine libraries for async IO, parser combinators, etc).

Out of the things you mentioned, server-side programming is the one where Haskell fits best. Server-side programming is more amenable to unusual languages because you get to choose your own platform and there are plenty of mature web frameworks you can use (too many of them, I might say). It might be worth a try to experiment writing code in a more type-safe language. Even the simple things like algebraic-data-types are things I miss a lot when working on other languages.

> Could you guys explain to me what Haskell would be mostly useful for. For instance, can it be used to make a web app backend or a GUI app?

Yes, and yes.

> Also, can you recommend a good book or resource that uses real world examples to teach Haskell?

The obvious thing to recommend here is Real World Haskell [0], which directly addresses some of the areas you raise.

Also, Write Yourself a Scheme in 48 Hours [1] is more in-depth and real-world than most tutorials (writing a Scheme interpreter isn't exactly a common real-world application, but its more real-world scale than most tutorials address, and it uses a lot of things that are of concern in many real-world apps.)

[0] http://book.realworldhaskell.org/read/

[1] http://en.wikibooks.org/wiki/Write_Yourself_a_Scheme_in_48_H...

Thanks, I think Real World Haskell was the resource I was looking for. I'll try to get through it in the next month and see how it goes.

It's worth noting that it was written quite a while ago, so while it's still a great book, there are portions that have a wee bit of code rot. In the event that one of those sections trips you up, I'd encourage you to visit the #haskell IRC channel!

Haskell is useful for just about everything that Python, Ruby, Java, C#, etc are useful for. For the last 5 years my day job has been writing Haskell. Most of that has been web apps, but there have been other things like machine learning applications, a nice command-line interface to Amazon Redshift, an automated ETL tool for a large production application, and most recently a complex interactive browser app (using GHCJS to compile Haskell to Javascript).

What confuses you about using Haskell for writing Web/Desktop/Mobile apps? System.IO exposes all the primitive input/output functionality one would expect in Swift, Python, or PHP, and there is an abundance of higher-level libraries for networking, parsing, graphics, etc. Haskell even has a fairly usable C FFI.

Haskell is a general purpose programming language.

A popular introductory text like Learn You A Haskell doesn't introduce IO until chapter 9. It never gets beyond simple toy programs and the only further resource suggested (in the FAQ) is Real World Haskell.

RWH is well-written and covers some real-world tasks, but some of its examples are outdated enough that they don't even compile anymore (at least, I encountered that scenario a year ago or so) and Haskellers will frequently warn people that parts of it are out of date (see elsewhere in these comments).

I actually think one of the shortcomings of Haskell's approach to new developers is that it _is_ very much a general purpose programming language and sold as such. Other languages have extremely popular frameworks or applications which serve to attract newcomers. People teach Swift or Objective-C to write iOS apps, Java for Android apps, JavaScript to do web apps, Ruby to write web backends in Rails, C# to write games in Unity... hell, people learn Java to make Minecraft mods. The closest thing I can think of for Haskell is Xmonad, which doesn't exactly have mass appeal.

Someone else suggested "Write Yourself A Scheme" as a good practical introduction, and that in itself says a lot about who Haskell appeals to -- people who are interested in programming languages. The MLs and Haskell remind me of Brian Eno's line about how the first Velvet Underground album only sold 30,000 copies, but "everyone who bought one of those 30,000 copies started a band".

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact