SPA Conference session: Real-world Haskell

One-line description:Discover beautiful solutions to realistic programming problems
Session format: Long tutorial (330 mins) [read about the different session types]
Abstract:Our aim is to show how Haskell can be used to create simple and elegant solutions to real-world problems, through the development of a small, yet significant, real application for telecoms pricing. Participants will learn enough about the language to evaluate its relevance and interest to them and will gain a solid foundation for further learning.

We have seen a growing interest in functional languages and Haskell in particular. This is partly fuelled by the hope that such languages may offer a way of coping with ever larger and more complex systems, and may deliver software that scales more easily over multiple parallel processors. Certainly Haskell is a very expressive language with rich libraries offering high levels of abstraction, and its strong formalism and extensive compile time checking aid verification of program correctness and allow us to reliably reason about code.

However, Haskell can be difficult to learn and understand for even the very seasoned software developer as it not only provides an unfamiliar execution paradigm, but includes concepts and facets not found in imperative languages. The task of learning is not helped by the fact that most of the tutorial material available is either very basic or very academic, often relying on prior knowledge that the commercial developer simply does not have. Further, most of the examples and exercises given are very mathematical, often abstract and unrepresentative of real-world problems. As a result, Haskell is often considered to be more an academic playground than a practical language for commercial use.

While acknowledging that Haskell is not yet ready for the mass market (it simply does not have the resource availability, tool support or library coverage), we hope this session will help to convince the inquisitive minds and pioneering spirits who attend SPA conferences that Haskell is the new frontier that must be explored

We will cover:

- Syntax
- Defining data types
- How Haskell programs execute
- Encapsulating unavoidable side-effects with monadic IO
- Programming with embedded DSLs

We will steer clear of as much computer science as possible and not get into any depth about the mathematical underpinnings of the language. We will focus on practicalities and try to demonstrate the joy of working with a such an expressive, rich, declarative language.

The tutorial application is a stripped back version of a real commercial project written by Peter.
Audience background:Participants will be experienced software developers primarily in imperative languages. They will have at least a basic understanding of the functional paradigm. In preparation, participants are advised to study some basic Haskell tutorial material such as A Gentle Introduction to Haskell found at
Benefits of participating:- Learn about Haskell by working on a real-world application
- Evaluate the relevance and interest of Haskell to you
- Gain a solid foundation for further learning
Materials provided:Open source Haskell tools, quick reference sheets, Web reference links, tutorial tasks. Participants should install GHC on their laptops before the session.
Process:The session is focused around the development of a telecoms least cost routing application. Participants will undertake three one hour iterations, each adding a new area of functionality and giving a different perspective on the language. Each iteration will be preceded by some tutorial. Participants will work in pairs and we will review observations briefly before moving on. A worked solution will be provided at the end of each iteration so that participants can move on even if they did not complete the task.

The session will conclude with reflection and discussion.
Detailed timetable:00:00 Tutorial 1: Haskell like other languages
01:00 Iteration 1: Reading CSV
02:00 Break
02:20 Tutorial 2: Haskell not like other languages
03:05 Iteration 2: Least cost routing
04:05 Break
04:25 Tutorial 3: Sequencing
04:35 Iteration 3: XML output
05:35 Reflection
06:00 Close
Outputs:The code produced by each group with video of the observations. Video of the reflection.
History:This is the first presentation of this session.
1. Peter Marks
2. Nicholas Simons
3. Ben Moseley