views:

697

answers:

10

Is there a functional language that has good support and tools for building web services? I've been looking at Scala (which compiles to the JVM and can use the Java libraries) and F# (which is .NET), but these are young and have some inefficiencies. Scala in particular doesn't support tail-call elimination except in self-recursive functions, which limits the kinds of composition you can do (this is a fundamental limitation of the JVM). F# is very new and doesn't seem to be fully supported yet, which makes it riskier than a more conventional language.

Is it possible to build a web service using Haskell, ML, or any of the other more traditional functional languages, or would it be better to go with Scala or F#? Any other suggestions?

A: 

Though I can't recommend it because I'm still playing with it, Erlang is very powerful.

Austin Salonen
+4  A: 

Haskell:

Take a look at this question: What is the simplest way to write web apps in Haskell?

Basically, WASH, HAppS and Janus are the three big ones in Haskell at the moment. My vote is for HAppS which has the best tutorial at the moment.

There is also HSP but I haven't looked at it or thought about it recently.

Jason Dagit
+2  A: 

If you're doing this for fun, and not for any robustness or workplace, you could investigate ARC. It's an unfinished, in-progress language, with the advantages and disadvantages that implies.

disclaimer: not affiliated with ARC or Paul Graham

Tom Ritter
+5  A: 

Ocaml has Ocsigen/Eliom... I can't say I've used it, though. It is also in it's early phases.

nlucaroni
I've been using Ocsigen for a few weeks now, and can vouch for it working quite well. It's also at 1.2 now, so they are at least confident enough in it to give it a real version number.
Michael E
+9  A: 

If .NET is an option for the platform, don't discount F# because of its youth. As it get closer to becoming an official product, it is getting better and better integration with Visual Studio and inherits all the goodness afforded by .NET.

There is also active and accessible support by both Microsoft and an enthusiastic community.

Steve Owens
+4  A: 

Erlang, with Yaws. It's a fun, powerful language, scales remarkably well, and makes using 100 or 1000 processes safe and easy. And fun.

(I also think it's pretty.)

Chris Pine
+4  A: 

Please read this introduction on F# and ASP.NET which will give you a good start.

There are several examples on the web in which F# is used in web applications. One of them is for example the autocompleter of Tomas Petricek which he built as an illustrative application to his article "F# Web Tools: Ajax applications made simple". I have used F# as part of a webservice myself too and I guarantee you that it works well :).

Michiel Borkent
+1  A: 

Reddit was built on lisp, was it not? And Paul Graham speaks very highly of its agility, especially with webapps.

Loren Segal
A: 

The previous generation of functional languages have tools like Ocsigen (for OCaml) and HApps (for Haskell) but they have virtually no users: they are completely untested software.

In contrast, Scala and F# build upon very well tested code from Java and .NET. In particular, F# has been very heavily developed by Microsoft over the past year because it is being productized. No other functional language has ever received that level of backing and, consequently, F# is already very usable (and far ahead of languages like Haskell in terms of development tools).

Jon Harrop
A: 

You might consider Clojure - it's a very new language, but looks very promising for scalable concurrent applications and has the advantage of very good JVM integration and access to all the Java libraries (just like Scala).

Clojure also has quite a few design features which get around the tail recursion issue (special recur construct, many core functions are implemented iteratively etc.)

mikera