Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I write components in Haskell to be used on a Django site?

Tags:

haskell

django

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.

like image 627
jberryman Avatar asked Oct 01 '09 21:10

jberryman


1 Answers

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.

like image 162
spookylukey Avatar answered Oct 16 '22 04:10

spookylukey