Source code of well designed functional web apps?
-
13-09-2019 - |
Question
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?
Solution
There's:
- Compojure (clojure)
- PLT Scheme Webserver (PLT Scheme)
- Erlyweb (erlang)
- Seaside (smalltalk)
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.
OTHER TIPS
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/
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