A Simple Haskell Web Server
February 14, 2008
I am always interested in web development as that is the industry I work in. As I also have an interest in Haskell I decided to try out using Haskell for web development.
There are some innovative web frameworks developed in Haskell, such as HAppS and WASH. There are also simpler approachs such as CGI and FastCGI libraries. I decided to develop my own simple web server and framework as I was interested in how Haskell would fare with more conventional and simpler HTML and database backed web sites, but was after more flexibility to experiment than CGI based approaches can provide.
What I’ve ended up with is not production quality by any means, but it provides a good and simple base to experiment and work from. Thanks to the HTTP and network libraries it worked out to around 20 lines of code. Below I present the primitive interface of the web server and its implmentation.
The Actors Model and Haskell
September 8, 2007
Recently I have been playing around with Scala, and in particular, the Actors library. This encouraged me read the paper ‘Actors: A Model Of Concurrent Computation In Distributed Systems’ written by Gul A Agha. This paper enabled to me to start thinking of Actors in more general terms, rather than as a Scala library. To refine this knowledge I decided to experiment by implementing basic Actor functionality in Haskell.
HST: Handling more message syntax
August 17, 2007
Unfortunately I’ve been busy since deciding to place HST on Google Code, so have not had time for major enhancements. Those ‘enhancements’ I have attempted, proceeded in a rather haphazard fashion and lack direction. This post will help refocus my attention on smaller goals and more disciplined testing.
After adding testing to the basic parser, it is now time to expand the parser’s functionality, adding the ability to handle more features of Smalltalk. I have chosen to add support for more complex message sends. I wish to support multiple keyword/primary pairs so that expressions such as prim a: 'arg1' b: 'arg2' are able to be parsed.
In adding this functionality I take small steps and ensure that testing is kept up to date with the work I carry out. Although at the end of this development the execution engine can not compile, I believe the parser is futher forward than with my previous, rather random, additions.
HST now at Google Code
August 10, 2007
I have just set up a project at Google Code for HST – A Smalltalk interpreter developed in Haskell. This is earlier than I initially planned, but I think that it’s impossible to be too early, even though there is only just enough code to run Hello World at the moment. The project can be accessed at http://code.google.com/p/hst
I have not had a chance to set up much as far as web pages go, but the code I have so far is checked in and a discussion list is set up.
I hope to continue add functionality it in the coming weeks, and have some blog entries on some of the more interesting changes.
Parsec Parser Testing with QuickCheck
July 29, 2007
I must admit I’ve liked the concept of QuickCheck ever since I first found it. I tend to write tests that are “too nice” to my code, often missing corner cases and errors caused by strange input. QuickCheck helps me avoid this by generating test data for me. Even in trivial projects it has helped me detect bugs I wouldn’t have found through unit tests written myself.
In this entry I begin testing the parser for HST – A Smalltalk interpreter developed in Haskell (the code developed so far for the parser can be found here and here). To do this I’m going to make use of QuickCheck. I couldn’t find much information on testing a Parsec based parser using QuickCheck, but I’ll have a go and see what happens.
The approach I’ve decided to try here is to have QuickCheck randomly generate an instance of the Abstract Syntax Tree (AST) I’ve developed. I’ll develop a pretty printer that can convert this to a String. Parsing the String should then result in the originally generated AST. I’m not entirely sure this will work, but at least it should give me a good starting point.
Completing the Spike
July 23, 2007
This entry continues work on the Spike Solution for HST – a simple Smalltalk interpreter developed in Haskell. In my previous two posts, I developed a parser that was able to parse a Smalltalk version of ‘Hello World’. In this entry I begin developing the execution phase.
I’m going to continue with my approach of keeping it simple and naive for now. I’m aiming for an interpreter than can parse and execute ‘Hello World’ before I begin adding features and improving robustness.
Refining my first steps with Parsec
June 22, 2007
To start gaining experience with Parsec and Haskell I completed the first working version of a parser for SmallTalk’s version of ‘Hello World’. To follow up I decided it would be worthwhile getting advice on those parts that just didn’t feel right. Off to Haskell Cafe I went.
I had only heard good things about the Haskell community, and after my experience I have nothing to say to the contrary. My post and the follow up responses can be found here. Thanks to all those that responded.
First go with Parsec
June 19, 2007
Parsec is a library I’ve been interested in trying out seriously since I discovered it. I have written basic parsers for Java projects before and it has not been fun. The Parsec examples I’ve seen have captured my interest. So, now that I’ve decided I’d like to start a decent sized Haskell project I looked for something where Parsec would be involved.
This post describes the result of my first attempts at using the Parsec library for something semi serious. It’s not intended as a tutorial or introduction to Parsec, but to show how simple and straight forward it can be to use.
Welcome
June 16, 2007
Welcome to my first attempt at blogging. You can find a little bit about me here.
I have no set theme or agenda for the blog, so I will just blog about whatever takes my fancy at the time. Mostly this will be software development related, such as something interesting I’ve come across while working on a project. I am a Java developer by profession, and currently Haskell is my favorite language in my free time, so most likely I’ll blog about one of those languages.
Of course, as this is my first attempt at blogging, I offer no guarantee about the quality or regularity of content, but I still hope someone enjoys reading.