Wednesday, November 12, 2008

Functional Programming for the Web

Ever since I saw a link on reddit for a functional language that was designed for web programming, I became interested in the idea. Not really sure why I waited until then as I was playing with Haskell for a while. It looked like someone was going the pure functional programming route similar to Haskell and Erlang. I even looked into Erlang and Yaws, but wasn't impressed with what I saw. None of it looked like how I'd want to program the web.

Here are my current thoughts:
  1. Have it be a hybrid language, perhaps similar to D. One thing I noticed with both functional and procedural languages is that some problems are more easily solved in one vs. the other, so why not take the strengths of both and leverage them?
  2. Treat IO, such as the results from a database query, as streams that can be acted upon using map/reduce/foldr/whatever functions. To me, this would make things very clean.
  3. Be lazy. Web programming can be described as processing some data and sending the user a response in a short timeframe, so why not only do what needs to be done and ignore what doesn't need to be done?
Now, I haven't figured it all out, and may never do so, however I think this will work nicely. The thing to remember is that web programming is ideally used for applications with very simple data processing needs. Nobody wants to wait for a web page to load and web servers really aren't meant to do real data processing. It shouldn't be impossible to do so, but the language should be focused on making it very easy to do the most common things, but possible to do the less common.

Labels: , , , ,


Post a Comment

Links to this post:

Create a Link

<< Home