ANN: loli: a minimal web dev DSL

loli is a DSL built on hack. It allows you to easily define routes, build your custom template backends through a simple Template interface, and integrate with other hack middleware. * driver The simplest app looks like this import Network.Loli import Hack.Handler.Happstack main = run . loli $ get "/" (text "loli power") * route get "/hello" $ do text "hello" will route "/hello" to a controller that outputs hello. * middleware using a middleware is just as declaring middleware lambda * template the template interface is class Template a where interpolate :: a -> String -> Context -> IO String Context is just [(String, String)] After implementing your own template engine, you can use output $ your-engine-constructor "template-name" * demo I put the source of a dummy paste app on itself: http://lolipaste.easymic.com/00000-lolipaste.haskell loli is on hackage, lolipaste is in loli repo on github: * http://github.com/nfjinjing/loli happy hacking -- jinjing

Thanks for this! I am using it since yesterday. And also for all the Hack work. I can switch my loli app's back end between happstack and hyena (eg) by changing a single import. Nice. There is a problem with Safari, I think in either loli or hack: at the top of the page you see http headers ("HTTP/1.00 Connection: close Content-Length: 44255 Content-Type: text/html Date: Mon, 29 Jun 2009 16:27:04 GMT Server: Happstack/0.3.2 "). It's fine in firefox. Best, -Simon
participants (2)
-
Jinjing Wang
-
Simon Michael