
I'm interested in seeing something like this too. However, I am a big fan of DSL, especially if they're designed correctly. The crux to having a good DSL is thinking: "How do I *really* want to write this?", and starting from there on. I haven't really thought about those things for a web-framework yet. -chris On Mar 29, 2007, at 10:48 AM, Johan Tibell wrote:
Inspired by the ease with which Joe Gregorio put together a framework in Python using some components [1] I'm inspired to create some components of my own so the same thing can be done in Haskell. I'm aiming for creating some thing /really/ simple and I want to start with writing a templating system or a database wrapper. But first, what has been done in this area already already? I'm aware of at least some template like efforts [2]. For the templating system I don't think I want a DSL like approach (ala Lisp with (body (h1 "Foo")) etc. but rather a solution where code and templates are kept separate. Here's a really simple interface.
compileTemplate :: Stringable a => a -> Template renderTemplate :: (Show a, Stringable b) => Template -> Map Stringable a -> b
Or something along those lines. Compiling the template makes subsequent rendering faster and ByteString adds even more speed.
With some templating language like so:
<html> <head>...</head> <body> <h1>{{ title }}</h1> </body> </html>
'title' is looked up in the Map when the template is rendered. The other option would be inline Haskell code:
<html> <head>...</head> <body> <h1><% postTitle title %></h1> </body> </html>
Where 'title' is a record data type. There's also a middle ground like with Django's templates that supports restricted inline code. I guess the restriction is unnecessary in Haskell as we can disallow mutation of values quite easily (?).
1. http://bitworking.org/news/Why_so_many_Python_web_frameworks 2. http://blog.moertel.com/articles/2006/10/18/a-type-based- solution-to-the-strings-problem _______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel