What’s the deal with this website?
21 Feb 2008
See http://www.updike.org/blogg/ or
darcs get http://www.updike.org/blogg/
to get the code for my Haskell Web Framework (working title). Not cleaned up or Cabal’d or anything but it may prove useful to Haskellers out there. Available under GNU GPL v2.
27 Mar 2006
Code for this Haskell Web Framework (HWF) was posted here. Available under GNU GPL v2.
17 Mar 2006 emails
I checked your web site and I understand that you are working on some kind of web framework/wiki system in Haskell. I am looking for something of that ilk for some new web applications that I want to create and I have been researching a number of Haskell-based web frameworks (HAppS, WASH, Flippi, etc.).
I saw some of these and thought they looked really cool. I think HAppS is supposed to be a real strong performer and allow use of databases of all kinds. On the other hand, my software is about simple text files as structured data so things are all maximally hackable at all times, but performance (i.e. hundreds or thousands of connections) is not the main goal (or even possible).
I think I saw Flippi a while ago and thought it was neat that someone had a working Wiki-clone but I didn’t like the CamelCase link syntax and other things like that, so I made my own to deal with all my nit-picky design requirements.
I wondered if you are using any of those or if you are writing your own and in the latter case if you plan to make it publicly available.
I haven’t really used those packages; for me doing it myself is a better way to learn and understand, but it takes a lot longer and everything grows gradually. Right now, mostly I am porting functionality over from my old all-Python/CGI version of my website with large feature improvements and aesthetic changes. Before, everything in Python was string based and hacked together to generate the pages. But now everything in my Haskell code is all structure-based (Document types, etc.) and then pretty-printed to XHTML. Basically, this is a single Haskell CGI program (a binary called index.cgi) that gets requests from Apache and then spits out pages. Nothing too exciting (except all these plans I have in my head...), but of course I like it because it’s my own personal jamboree of features (or, it will be, when I get to them...).
I wouldn’t mind posting the code if you care to look through it, but it is in need of some rewriting and refactoring and spring cleaning to update it to the nice version floating around inside my head... you probably know how that goes... In other words, it’s not in a developer-friendly library format, but you could hack at it and see where you get...
I guess the overarching design goal for my approach is to move a lot of the complexity and power of the website into the parser and markup capabilities (which is also slated for a full redesign/rebirth). Right now the content is all contained in specially marked up text files and the program converts these to nicely formatted pages. These pages are editable through the browser (I have a simple login system but I’m the only user). Part of the reason I made this fancy system (especially a featureful parser) is that I want a way to write all kinds of documents (articles, webpages for projects and things, math notes, Haskell source code itself as a document, links, quotes, etc.) and have "ideal" (standards compliant + human readable) HTML as well as publication quality printer formatted documents (i.e. LaTeX/PDF) all generated from a single source text file. The catch (why I don’t just input everything in LaTeX and use one of many TeX2HTML converters, or vice versa with HTML) is that HTML is far too verbose and not-high-level-enough, and LaTeX is better but still too verbose, i.e. for italics HTML is
v. TeX which is
v. my parser which reads in
and spits out either of the above when needed. (But if you have a single / anywhere in your text that is correctly treated as a single slash character so you don’t have to escape it when you write casually.) So, in a sense, I want the marked up text files to feel like a sort scripting language of their own, but still really high level (i.e. structure- and document- and content based instead of like PHP where things are string based (low level) and so forth).
Back to the email
More in general, as I am very new to Haskell, I wondered if you could give me some advice on the best tools/approaches to Haskell-based web development.
(Well, I probably confused and overwhelmed you with too many details but it was fun to write out my ideas.) My advice would be to decide what you want more:
- a working system soon with lots of features but a larger time investment of learning the APIs and reading manuals (in which case try WASH, HAppS, etc.) (which may not in the end have a wiki-system or web framework to your liking, so you’d have to do the work of learning these systems and implementing your own desired framework on top, that is, if it doesn’t already exist in these systems... not sure), or
- understand what’s going on at all levels and controlling it, but taking a while to get enough functionality to have really useful software (I’m not quite at the state of true usefulness yet; I’m really really close, but not there yet, e.g. I’ve been needing to implement ’Add new page’ for weeks but I’ve been busy at work and been sick).
I took the latter path because I’m relatively new to Haskell (coming up on a year now, actually...) and this is partly how I’ve been learning Haskell. If I had more time and focus, all these planned features would be implemented and the code would all be clean and readable and I would use this software to write a book/tutorial on how to learn Haskell and build website-building software in the process. And then anyone who wanted could download the software and install and compile it and start playing with making their own webpages and then start hacking them in Haskell/"futuristic high-level scripting language that doesn’t exist yet". Unfortunately I’m not there yet.
Any info/tip will be very gratefully received.
If you want to take the same tack I took, I’ll offer up any code and advice on how to try things.
For example, I would recommend getting a simple static webpage spit out by a Haskell program, like
contenttype = "Content-Type: text/html; charset=utf-8" httpheader = contenttype ++ "\n\n" main = do putStrLn httpheader putStrLn "<html><head><title>Test title</title></head>" putStrLn "<body><p>Hello world!</p></body>"
and then putting it in a place where Apache can get to it (this isn’t hard but is annoying to get working sometimes, if you have problems I could help you), then point a browser at it and see if it works.
Once you have that, maybe next would be to see if you can make pages in a structured manner in Haskell and have some module to generate the HTML for you (my XHTML module, or a really cool one mentioned recently here. Then try learning about parser combinators and use Parsec (my favorite parser combinator lib) to parse the text files and generate structured documents which then get converted to HTML and sent to the browser by the program you’ve been writing. Something like that.
Thanks in advance for your help in this matter.
Thanks for your questions and I hope I’ve been of help... Please ask more questions if this stimulated your interest or if I’ve made things more confusing instead of less. I’ll post the code soon.
18 Mar 2006 emails
The kind of web framework that I am thinking of is more along the AJAX model than the CGI one.
I agree; CGI feels very arcane these days :)
That’s a really great idea. I really want to create more flexible pages using AJAX instead of CGI but I don’t have enough experience developing with it. If you pull anything together (even if it’s simple) let me know. I would love to learn more about it from the Haskell point of view.
CRAZY FUTURISTIC IDEA
on my list of things to work on (you’re welcome to attack it and think about it too):
This is something I think would place Haskell head and shoulders above all other programming languages: if you could just write applications in high-level Haskell code and it generated all the glue to make all the calls to the server and such; bascially it wouldn’t matter which parts were client or server side, your program would just run in a browser much the way people write software with GUIs and don’t worry anymore about the low level details of mouse interaction, displaying menus, etc.
If you check out the source code examples in http://www.informatik.uni-freiburg.de/~thiemann/haskell/WASH/WASH-CGI-gallery.html you’ll see what I’m talking about. The code is really simple and high-level, and all the glue is generated for you.
Now, to take it a step further, it would be really cool if you could make programs like the examples in http://www.md.chalmers.se/Cs/Research/Functional/Fudgets/Intro/ especially something like http://www.md.chalmers.se/Cs/Research/Functional/Fudgets/Intro/ex8.html but on the web. Notice how short the code is! But instead of running a program on your computer, this (hypothetical) AJAX package would spit out a webpage that looked like that calculator, and then when you clicked the buttons it would send the events to the server and the server would handle them, compute some calculations, and then send it back using AJAX magic. You could write powerful, flexible web applications and spend time on the program logic instead of the glue.
By the way, I found some more leads on Haskell web framework stuff:
This recent thread talks more about your general question of Haskell and web frameworks stuff.
Someone on the thread mentioned this project. This software looks like a really good place to start playing with things. I’d forgotten about it but you should check it out if you haven’t already...