In his recent paper Spreadsheet functional programming, Dave Wakeling discussed the idea of using a functional programming language from within a spread sheet.
It’s an interesting approach, because the implementation effetely allows you to write code (in this case Haskell) in cell comments, in such a way that the results are computed on the fly – i.e. not complied.
As you might expect, there are a number of issues with the implementation from a practical stand point, but that’s not what I’m interested in here – I want to talk about the concept of functional programming in relation to spread sheets, which this paper also focuses on.
It’s my view that a spreadsheet is a functional programming language. This means that I have an issue with the goal of the paper, which is:
“Our hope is that by doing so, we might get spreadsheet programmers to give functional programming a try”
Nothing wrong with that, but my views that spread sheet users already are functional programmers!!! So why them might we want to use Haskell with Excel? Towards the end of the paper Wakeling suggest some possible strengths to this approach.
1. It uses an ordinary spreadsheet. The functionality of, experience with, and Support for a familiar product all carry over.
2. It uses an ordinary functional language. The benefits of such languages also carry over. (Backus, 1978; Turner, 1982; Hughes, 1989).
3. It can accommodate any pace of change. The old way of doing things can coexist with the new one.
Unfortunately I don’t agree that these are real benefits. Oh dear! – Why?
1. This is a case for anything that integrates with Excel; the benefit is independent of what it is that’s being integrated. This is the benefit of using a spread sheet and a programming language over using a programming language on it own. It’s tenuous to claim it as a strength.
2. The benefits are true of Functional v’s Imperative programming languages (lasy, high order functions). Since Excel functions operate in a very similar way to functional programming these benefits don’t really exists between Excel worksheet functions and a functional programming language.
3. This statement is true of any situation where the 2 technologies can co-exist you could say the same about using C, VSTO etc, etc, again it’s really tenuous to claim it as a strength of any like for like approach.
So if these strengths are not in fact all that real, then why would we want to use a functional programming langue with spreadsheets? Perhaps a clue is given in this passage:
“On the positive side, many everyday programming errors are detected that would otherwise lead to incorrect results, including dangling cell references, undefined functions, and functions with the wrong type of arguments.”
I can see how using a more “strongly typed” language could possibly help reduced type errors, not sure how undefined functions would be helped or how “dangling cell references” (in fact, I don’t know what this means at all) would be effected. Generally further discussion and justification of the benefits of using a functional language with a spreadsheet are needed to build a case for doing so.
The paper did not convince me that using a functional language has any really benefits to using worksheet functions or any other programming language. Having said that, the paper does show that its possible to link technologies like this and it’s another interesting approach to programming spreadsheets. The prospect of F# and XLDNA and F# in VSTA/O are also interesting things to start thinking about! The application of functional programming languages within spreadsheets is interesting and Wakeling should be congratulated for opening up the debate for future discussion– as hopefully this post will do too!

