First try Haskell web applications

I’m trying Haskell for writing Web applications. It should be really easy, but at the moment I’m missing the examples. The documentation doesn’t really help for generating the XHtml. The following bit of code is something that I found: Haskell and Web applications. The article contains a simple example. I changed the code in the example to use a table instead of the spans. This turned out to be really easy to do....

May 15, 2008

Big error in my regex code

When I first posted the simple regex code I thought that it contained no errors. But when I tried it a few days after that with a few simple testcases (which I hadn’t considered in the test code) it failed. ok $ match "world$" "world" ok $ match "world$" " world" ok $ match "world" "hello world" The first testcase worked. The other two didn’t, but they should have. After a bit of inspection with the trace function in Debug....

April 10, 2008

Simple Haskell regex program

I wrote a small piece of code to match a regex to a string in Haskell. The code is based on the example from Beautiful code. match :: String -> String -> Bool match ('^':reg) s = matchhere reg s match reg s@(x:xs) = if matchhere reg s then True else matchhere reg xs matchhere :: String -> String -> Bool matchhere [] _ = True matchhere ('$':[]) [] = True matchhere (x:'*':xs) s = matchstar x xs s matchhere (r:rs) (x:xs) | r == x = matchhere rs xs | r == '....

March 5, 2008

Haskell and XMonad

In my quest to learn Haskell I come across XMonad, a tiling window manager. At home I already use Pekwm. On my laptop I use XMonad now. To configure it I have to use Haskell, so that helps. After sometime using Haskell, I looks like I get a hang of it. I tried it a bit before, but now I really start to get a hang of it. If you want to learn Haskell to take a look at A Taste of Haskell a video/presentation by Simon Peyton Jones in two parts....

March 4, 2008