By Peter Bell

On Functional Programming

One of the many great things I took away from cf.objective() last year was from a very interesting discussion with Sean Corfield. One of the things he strongly recommended was to learn a functional programming language like Haskell.

The point he made (and I've heard this echoed by a bunch of other very smart programmers since) is that even if you don't end up using the functional language, it'll give you a whole new set of ways to think about solving problems that can be used in imperative languages.

Given that, here is just a nice intro article about some of the benefits of functional languages. Anyone out there tried Scala? Anyone have any comments on approaches they learnt from a functional language that they've used to solve problems in CF?


I took up Haskell a few months ago on a whim. After re-reading some of Seans posts on Functional Programming and how it applied to ColdFusion, I was interested. An article from Linspire ( ) cemented the deal. Apparently, they decided on standardizing core OS development on Haskell, a seemingly odd move I thought. However, I am sure they know a lot I don't, so I pulled the trigger.

I expected a tough time setting up an environment but it was a piece of piss, really. There are several interpreters and compilers. I used GHC ( ), as it supported an interactive mode, as well as a compiled mode.

To help me learn, I followed the tutorial 'Yet Another Haskell Tutorial' ( ). I liked this tutorial because there were exercises at the end of all major chapters and the solutions were included at the end of the tutorial.
# Posted By Dan Wilson | 11/27/06 10:25 AM
Hi Dan,

Cool. I'll file this stuff away for when I get some free time early next year! Anything you've taken from Haskell that has affected how you've solved a specific problem in CF yet?
# Posted By Peter Bell | 11/27/06 10:33 AM

Interesting question.

I've gained a new appreciation for functions as First Class Citizens, for sure. Though when I have done this in my daily work, i've been looked at with a raised eyebrow. I guess part of being in a team environment is writing code that can be easily understood by those of all skill levels.

# Posted By Dan Wilson | 11/27/06 11:20 AM
Guess it would be the same as trying to do object in CF back in the day. The problem with new techniques is that they actually place new requirements on the rest of the team in terms of learning. Maybe you'll have to pass the Haskell book round at the office? :->
# Posted By Peter Bell | 11/27/06 11:32 AM
BlogCFC was created by Raymond Camden. This blog is running version 5.005.