views:

450

answers:

5

I'm considering to learn a functional programming language. I decided to build a medium-sized web application.

I narrowed down the choices to Haskell and Common Lisp.

Web application needs to interface to some relational database (MySQL, Firebird or Postgres) and has to run on Linux. Obviously, it has to interface well with web server software. I have no experience with functional languages, my expertize is C, C++, PHP and JavaScript.

Which one is preferred for this use and why?

I'm not sure whether this question should be marked subjective? It really is not "which language is better", but rather "which is more suited for this particular task"

+5  A: 

Lisp has a good history on the Web. Yahoo Stores was initially written in Lisp.

Paul Nathan
A: 

If your prime consideration is to get a sweet spot between functional techniques and web functionality, I'd find it hard to beat F# considering it has all the .NET web stuff baked in. Thats a huge amount of pre-baked, production hardened code at your disposal. You could do MVC with it--and if you don't want to run on windows and have a pioneering sprit (which I suppose you do considering the question), then trying a MVC with F# on Mono would be really out there! I'd love to see that combo!

I don't know Lisp--but compared to Haskell, F# would be much more productive as far as getting a web app written with a functional language... I love Haskell, but for what you want to do You gotta look as F# as the first option, IMO.

Kevin Won
F# on Mono works, but not quite as well as it could. http://www.mono-project.com/Runtime_Projects says that "Fix tail call support for F#" is underway.
ephemient
You don't say why F# is better, you assert it.
Don Stewart
A lot of F# stuff has seemed kind of rough around the edges when I've looked into it--.NET integration sounds nice on paper, but trying to use very non-functional libraries in a functional language is generally an exercise in masochism. If I needed to write a nontrivial application in F# I'd probably look into porting existing OCaml libraries rather than using .NET stuff... at which point I'd wonder why not just use OCaml and be done with it?
camccann
I posit that the mass of pre-baked web-oriented code already in the .NET framework is a significant factor in looking at F#. I should be clearer that I DONT have experience in LISP (but I'd be very surprised if LISP is killing it with web functionality). In resposne to don: that is why F# is worth looking at (I didn't say it was better).
Kevin Won
+5  A: 

In your position, I would pick Haskell for three reasons:

  • Fairly easy to learn
  • Hackage, which provides a lot of libraries that might do a lot of what you want, including HAppS, which provides a lot of functionality for server applications
  • Great community. Their IRC channel is great.
Eric Warmenhoven
About "Fairly easy to learn": Haskell is indeed a very small and very regular language (compared to, say, Java or C++) but I wouldn't exactly call it easy. Lazy evaluation and the concept purity might not be Haskell-specific but you still need to learn how to use them before being able to do *anything* in Haskell.
SealedSun
I would go further than SealedSun and say: haskell is generally too hard *to get things done with* for most people.
Paul Nathan
Don't be ridiculous. Haskell may be very unfamiliar to people coming from mainstream imperative languages, but learning enough to just pick it up and do something isn't a big deal. It may take a bit longer to really get going, but if someone actually wants to *learn* it's not difficult at all.
camccann
+6  A: 

'Common Lisp' is not really a functional language. It has elements of a functional language, but equally includes support for imperative and object-oriented programming. Programs usually are written in a mix of those.

Generally Common Lisp and Haskell are very different languages.

If you want to learn advanced functional programming, then Haskell would be more suitable.

Writing web applications in Common Lisp using a database and running on Linux is possible and has been done.

Rainer Joswig
+7  A: 

Every language worth its salt offers plenty of libraries for web apps. Haskell is no exception, and there are 100s of web libraries for the language.

The availability of libraries should be your main consideration (other than say, needs for high levels of concurrency).

You can find the Haskell libraries for this stuff here:

All can be installed with:

$ cabal install $foo

Don Stewart