Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Real world Haskell programming [closed]

Having been an imperative developer for some years now, I had never had the urge to learn functional programming.

A couple months ago at last I decided to learn Haskell. It's quite a cool language, but I'm puzzled about how an event driven real app would be programmed in such a language. Do you know of a good tutorial about it?

Note: When I say "real app" I'm not talking of a real world, production ready app. I just mean a little sample app, just to get the grasp of it. I think something like a simplified version of the windows caculator would be great, and then perhaps something a bit more complex.

like image 724
raven Avatar asked Jul 11 '09 08:07

raven


People also ask

Is Real World Haskell outdated?

It's old. RWH was written at a time version 6.8 of GHC was being used.

Is Haskell used in real world?

Haskell has a diverse range of use commercially, from aerospace and defense, to finance, to web startups, hardware design firms and lawnmower manufacturers.

Is Haskell still used today?

Firstly, Haskell is still primarily used in academia and research. There are companies that use it (see list above) however, even they struggle to find good candidates that have experience. It can be rather complex and so not a lot of new programmers will try to learn it.

Who actually uses Haskell?

There are lists of companies that use Haskell on the Haskell web site and on Quora. A few highlights are Facebook, IBM, Twitter, AT&T, Bank of America, Barclays Capital, NVIDIA and Microsoft. Some interesting links are: Facebook uses Haskell in several projects, for example Fighting spam with Haskell.


1 Answers

When you say "real world" examples you are presumably thinking about problems that are inherently sequential or stateful or do lots of I/O, right?

So, how about games?

  • Frag is a Quake clone, implemented for an undergraduate thesis (Functional Programming and 3D Games, Mun Hon Cheong, 2005). Here's a video of it in action.
  • Super Monao Bros. (formerly known as Super Nario Bros.) is, well, you can probably figure out which game it is a clone of. (This is the author's English language weblog.)
  • Purely Functional Retrogames is a 4-part series of blog articles about how to write games in a purely functional language, explained using Pacman as the example. (Part 2, Part 3, Part 4.)

Or, what about an X Window Manager, an extensible Emacs clone text editor or an IDE?

Then, there is the book, which even has your question already in the title: Real World Haskell and which is also available for free!

Another thing you might want to look at, is Functional Reactive Programming. (It is used in Frag, for example.) The interesting thing about FRP is that it allows you to look at the problem of, say, GUI programming from a very different angle. If you read the GUI chapter in the RWH book, you will see that it talks about how you can write a GUI application just like in C, only better. FRP OTOH allows you to write it in a totally different way that wouldn't even be possible in C.

A lot of times (I'm not saying that this is the case in your question, but it is a recurring pattern) when someone says "but can Haskell be used in the real world", what they are really saying is "I know how to do this in C, and in Haskell I cannot do it in exactly the same way, therefore it must be impossible in Haskell, therefore Haskell is not ready for the real world". But what they are missing out on, is that there might be a totally different and much better way to solve the problem. (It's like saying "Erlang doesn't have threads, therefore it cannot possibly be used to implement concurrent systems.") And FRP is just one example.

like image 121
Jörg W Mittag Avatar answered Sep 27 '22 22:09

Jörg W Mittag