views:

180

answers:

4

I have an idea for a web service, but am very new to web programming. Django looks great and like something I can pick up quickly. I have a lot of experience in Haskell (and very little in python) and would like to be able to start writing some of the backend non-web-related things in my favorite language. But of course I don't want to do that if the haskell code won't be usable if I go with django.

I have been looking at several haskell web frameworks: hApps looks too complicated and undocumented, turbinado looks approachable but is undocumented, etc. And I think using a widely-used framework like django, and having access to a lot of code that I can just plug in will help me a lot. But I am very open to hearing about other ideas on frameworks to use, or other options I have to use Haskell in some way.

+1  A: 

Learn python, you will find it has many functional features. It is easy to pick up and very enjoyable.

Good pick with Django.

Kugel
What are python's non-functional features? Other than antigravity (http://xkcd.com/353) of course.
Dominic Rodger
@Dominic: The ability to mutate objects. The ability to rebind variables. Limited support for lambda functions (this is a big one). Lack of support for composing and partially applying functions.
Chuck
+3  A: 

If you're just building a web service you can write cgi or fastcgi programs in Haskell to handle the web service calls.

Amuck
Is that a method that will work with django, or an alternative? I have some understanding of CGI outside of django, but not really clear yet on how django/CGI work together.
jberryman
@jberryman: I don't know how Django works with CGI, but if you're just writing a web service I'm not sure Django is the right tool for the job. As spookylukey says, if you mean a standard web application then that's something different than what I'm talking about. If you just want to provide URLs that return data then I think you should not use Django at all.
Amuck
+2  A: 

It depends on what you mean by "web service".

If you mean a typical web application/web site, you will needs an easy interface to a database, HTML generation, easy HTTP handling, sessions and form handling. You really need a decent web framework for that.

There are no 'good' web frameworks for Haskell out there. (In making that judgement, I'm including factors like documentation, community, probability-that-it-won't-be-abandoned-in-a-year-for-a-newer-shinier-approach etc).

If you mean something much less "webby" e.g. a service that returns map data, and don't need most of those features, you could could get away with something like Hack or even Network.CGI to provide you with the basic HTTP interface, onto which you would build your service, running with CGI/FastCGI. If you need a dynamic web site as well, you could use something like Django for just that bit.

You could also write Haskell standalone executables that are called from Django code. But direct Python <-> Haskell interop is unlikely to be possible/practical.

spookylukey
"Python <-> Haskell interop is unlikely to be possible/practical." -- it is certainly possible and practical to call Python from Haskell -- and useful if you need a library. See hpaste2's binding to pygments.
Don Stewart
You might find this surprising, but not every web application is "fill out a form (and show validation error mesages) and put the result in a SQL database".
jrockway
@dons: I think the original poster was talking about calling Haskell from Python. But I wasn't aware of any Python <-> Haskell interop, I stand corrected :-)@ĵrockway: agreed - that's why I said a "typical" web app/site.
spookylukey
+1  A: 

Go for F# and check out NDjango - which is a Django port written in F#. Full disclosure: NDjango is my project www.ndjango.com

mfeingold
That is an interesting proposition, but a lot of people aren't so hot on MS languages.
Chuck