Lately I’ve been taking a look at how you might write web apps with F# using various existing frameworks. Often these frameworks don’t quite work the way you want them to and have small but annoying nuances when using them from F#. These projects are:
PicoMvc – a minimalist MVC like framework. The basic aim of PicoMvc is to make it really easy to map an incoming URL to an F# controller function and then choose a view engine to render the result of this function. (github/nuget)
Log4f – an F# wrapper for the popular logging framework log4net (github/nuget)
FsRavenDbTools – some tools to make it easier to use the NoSQL database from F#, including adding the ability to save union types to RavenDb (record types can be save out of the box, but the Json serialize doesn’t know how to work with unions). (github/nuget)
FsLinqFixed – this is a version of the F# power pack provider that includes fixes for a couple of small but annoying bugs. Full details of the fixes are in the read me on github. (github/nuget)
These frameworks consist of very little code, but often you’ll find a little F# goes a long way. Sometimes all you need is a thin veneer of F#ness to make things work the way you want. This is partially true of log4f were I simple got fed-up of having to write logger.Info(sprintf "Message: %s" value) and created a wrapper that would allow me to write logger.Info "Message: %s" value, i.e. no separate sprint call required.
All tools need some improvement, this especially PicoMvc which is the largest of the three frameworks. Having said that I think it’s pretty usable so don’t be afraid to try it out, and if you find something you don’t like or want to work differently, send me a patch!
I have a little project that will involve using all four projects so hopefully we’ll see this pushing thought improvements to them all.
I’ll be writing a little more about them in the coming weeks/months.