[Haskell-cafe] Haskell web dev - ASP .NET analogue?
chrisdone at googlemail.com
Thu Apr 15 19:44:51 EDT 2010
The state of Haskell web development is exciting and messy. We don't
have a de facto way to do it like Rails or Django or ASP .NET, but we
do have many imitations and ideas popping up. You can easily judge
whether the community is happy with the state of web development by
the number of new web frameworks coming out all the time.
I'm wondering if there is a ASP .NET analogue for Haskell. ASP .NET
manages compiled languages like C# well by compiling a given page when
you run it, and also allowing you to build pages into DLLs and then
link them in your project. I have used this development process for a
year in a commercial business and quite like it. It's just really easy
to develop. Often you make little mistakes on a given page, so you
just edit one bit of code -- you don't want to have to run a command
to reload this code yourself. I think that, with Hint, one could write
a Haskell equivalent. The nice thing is you can test your Haskell code
in GHCi and then save the page and load it in the browser and have it
auto-recompile. As to how pages are generated I guess is up to whoever
is using it.
You have a kind of standard separation in ASP .NET:
Sub submit(sender As Object, e As EventArgs)
lbl1.Text="Your name is " & txt1.Text
Enter your name:
<asp:TextBox id="txt1" runat="server" />
<asp:Button OnClick="submit" Text="Submit" runat="server" />
<p><asp:Label id="lbl1" runat="server" /></p>
One could blatantly copy this model. And it's not a bad model. To
start with anyway. It has the benefit that it's familiar to many web
programmers, and, importantly, business practice/industry. My
backend.vb became backend.hs.
I wrote an ecommerce site (http://productsforhair.co.uk/) a year ago
in Haskell and used the Text.XHtml.Strict and hated it to be honest.
It looks like a complete mess. Look at these two examples of using
EDSLs to produce content. Messy and unmanageable.
As much as I love EDSLs like html combinators, as soon as you get a
nontrivial project with big complex elements it soon gets out of hand.
BlazeHtml makes this a little nicer with its `do' syntax but it's
still a problem.
More information about the Haskell-Cafe