11

What are examples of well designed functional (as opposed to object oriented) web apps that make their source code available? I am currently studying the Hacker News source but I'd like to see some other non-trivial examples, ideally in clojure.

For MVC there are lots of Rails and PHP apps, frameworks, and tutorials to study - what is there for functional programming?

Johannes Rudolph
  • 35,298
  • 14
  • 114
  • 172
Lorenz
  • 483
  • 5
  • 11
  • Arc and clojure are barely functional languages. Take a look at HappS: http://happs.org/ – jrockway Aug 12 '09 at 08:06
  • Maybe searching for "continuations based web applications" could bring you some interesting results. – fortran Aug 12 '09 at 08:51
  • Interesting framework and article - thanks! Do you have any links to real implementations of these ideas? For example, a shop system in Haskell, a continuations based CMS or simple blog software? I love learning from proven solutions that are live somewhere. – Lorenz Aug 12 '09 at 16:34

3 Answers3

7

There's:

That list is enough to keep you busy giving a sample of functional languages with different characteristics:

  • Clojure: multi-paradigm?, flexible? it isn't a pure functional language and although it is preferred that you program in a functional style, it isn't strictly necessary. You can write java-style OOP through the Java interop, or you can abstract away from it using multi-methods. There's a lot of flexibility there, although it is still a little early to say whether it is just "flexible" or "multiparadigm" in the way common lisp is. Designed, in part, to be a lisp that handles concurrency easily, it actually shoots at a lot of targets, hence the flexible or multiparadigm designation.
  • Scheme: Closer to being a pure functional language than Clojure, it pushes the programmer a bit more forcefully into a functional style than does Clojure.
  • Erlang: Functional programming built for reliable concurrency. Erlyweb is built on a platform that is designed to be highly concurrent.
  • Smalltalk: Highly OO functional programming (even control structures are objects within the object system, and not syntactic constructs).

If you want to see how webapps look in a language that is functional "at all costs", then the jrockway's suggestion is the one to look at.

Pinochle
  • 5,515
  • 2
  • 26
  • 20
  • For an introduction to the PLT Scheme web server, have a look at http://docs.plt-scheme.org/continue/ . – Eli Barzilay Aug 12 '09 at 18:11
  • Could you please explain why the PLT Scheme Webserver and Seaside are listed here? Are their implementation good examples of functional programming? – Vijay Mathew Aug 13 '09 at 03:50
  • @Vijay, both control interaction between the webserver and client using continuations. This would be the hallmark of the functional approach to web programming. One description of this can be found in the Yahoo! patent on continuation-based web servers: http://www.google.com/patents?id=WE8GAAAAEBAJ&printsec=abstract&zoom=4&source=gbs_overview_r&cad=0#v=onepage&q=&f=false this patent came from Paul Graham's work in writing what would become Yahoo! stores in Lisp back in the mid 90's. Check also fortran's comment to the original question for more info about continuation-based web servers. – Pinochle Aug 13 '09 at 04:52
  • Well, as far as I understand, continuations have got nothing to do with functional programming. – Vijay Mathew Aug 14 '09 at 05:51
  • http://en.wikipedia.org/wiki/Continuation Continuations are the way that functional programming language can grant access to the stack. They are the functional equivalent of goto statements. Of course, this all depends on what you mean when you say 'functional' and it is possible to restrict the meaning of this word to such an extent that nothing is 'functional' but a very restricted set of phenomena. Whatever floats your boat. It must be recognized, however, it is a question of perspective and most people will look at continuations as features of 'functional' languages. – Pinochle Aug 14 '09 at 06:09
2

Weblocks is a proven object-oriented functional framework that takes inspiration from Seaside.

It's written in Common Lisp, and two basic examples (weblocks-demo, simple-blog) can be found here: http://bitbucket.org/S11001001/weblocks-dev/src/tip/examples/

Leslie P. Polzer
  • 2,998
  • 21
  • 18
1

If you are looking for real-world open source projects implemented in a pure functional language, this link might help: http://haskell-news.blogspot.com/2008/01/top-10-most-popular-haskell-programs.html

If you are very specific about web applications, please look at this: http://www.haskell.org/haskellwiki/RPC

Vijay Mathew
  • 26,737
  • 4
  • 62
  • 93