Feeds

Programming in Haskell

Yes, Melinda, there is a choice: Functional Programming

New hybrid storage solutions

Book review While it may appear that object oriented programming has achieved dominance in terms of programming language paradigms, there still exist outposts that refuse to submit to the benefits of polymorphism, encapsulation, and object inheritance.

It's not just that there is a hard-core group sticking to procedural coding in C and refusing to go the Java/C#/Python/Ruby route. There are also those who have taken the functional programming route to programming nirvana, particularly those who use that purist functional language, Haskell. And it's a topic that seems to be of increasing interest to the broader development community as well.

Despite the conceptual differences between object oriented and pure procedural languages, they do in fact share common roots and a number of key features. Chief among these is that programs manipulate data and state. Computer scientists characterise this style of programming as imperative programming – the developer writes a series of statements that tell the computer what to do, changing the state of variables in order to complete whatever task the program is performing.

In contrast, functional programming (FP) has no concept of state – there are no variables that the developer manipulates. Instead, there are a series of functions which are applied to data and evaluated. Some of the data that these functions are applied to are themselves functions, and may deliver other functions as results. On the face of it this might seem like a bizarre and alien concept, and indeed the first time that one comes across Haskell, or any other functional programming language, it does seem odd.

There is obviously a strongly mathematical flavour to Haskell, which this slim introductory volume does nothing to dispel. The academic tone is partly because the book is geared to the computer science student (complete with excercises at the end of each chapter), but it's also recognition of the roots of Haskell in the academic community.

The book opens with some introductory background and then moves on very quickly to syntax and program structure. The explanations are generally clear, and the text is illustrated with simple examples. The author has assumed no prior programming experience, but those who've programmed before in a non-FP language would probably appreciate a bit more guidance on the differences between the FP and non-FP way of doing things.

The book looks at key concepts such as data typing, curried functions, folding, filters, and so on. What becomes apparent is that the language is concise, elegant and extremely powerful. It leaves the developer reasoning about algorithms without having to worry too much about the plumbing. Those who've programmed with APL, for example, will find a fair degree of familiarity. Similarly, those who've come across lambda functions (which derive from FP) in other languages, such as Python or Ruby, will find that Haskell presents a much purer expression of functional programming.

For the practicing developer looking to utilise Haskell in action, however, this book is not ideal. Its emphasis is more on giving the reader a solid conceptual grounding rather than on more concrete programming tasks. While there are some extended examples in the latter part of the book, it's still by no means a very practically-focused tutorial.

Nevertheless, whether it's closures in Java, lambda functions in Python or Ruby, XSLT transformations, or new ideas in parallel computation, FP is providing input to many different areas of modern development. This book provides a good introduction to the concepts.

Programming in Haskell

Programming in HaskellVerdict: Functional programming is generating possible new approaches to many development issues - perhaps most importantly to parallel programming on multicore systems. This book is a good place to get your head around some of its ideas, even if you don't intend to add Haskell to your program language arsenal right now.

Author: Graham Hutton

Publisher: Cambridge University Press

ISBN: 0521692695

Media: Book

List Price: £23.99

Current Reg price: £23.99 (inc VAT)

Buy this book at Register Books (price subject to change). ®

Reducing the cost and complexity of web vulnerability management

More from The Register

next story
New 'Cosmos' browser surfs the net by TXT alone
No data plan? No WiFi? No worries ... except sluggish download speed
'Windows 9' LEAK: Microsoft's playing catchup with Linux
Multiple desktops and live tiles in restored Start button star in new vids
iOS 8 release: WebGL now runs everywhere. Hurrah for 3D graphics!
HTML 5's pretty neat ... when your browser supports it
Mathematica hits the Web
Wolfram embraces the cloud, promies private cloud cut of its number-cruncher
Google extends app refund window to two hours
You now have 120 minutes to finish that game instead of 15
Intel: Hey, enterprises, drop everything and DO HADOOP
Big Data analytics projected to run on more servers than any other app
Mozilla shutters Labs, tells nobody it's been dead for five months
Staffer's blog reveals all as projects languish on GitHub
SUSE Linux owner Attachmate gobbled by Micro Focus for $2.3bn
Merger will lead to mainframe and COBOL powerhouse
iOS 8 Healthkit gets a bug SO Apple KILLS it. That's real healthcare!
Not fit for purpose on day of launch, says Cupertino
prev story

Whitepapers

Secure remote control for conventional and virtual desktops
Balancing user privacy and privileged access, in accordance with compliance frameworks and legislation. Evaluating any potential remote control choice.
WIN a very cool portable ZX Spectrum
Win a one-off portable Spectrum built by legendary hardware hacker Ben Heck
Intelligent flash storage arrays
Tegile Intelligent Storage Arrays with IntelliFlash helps IT boost storage utilization and effciency while delivering unmatched storage savings and performance.
High Performance for All
While HPC is not new, it has traditionally been seen as a specialist area – is it now geared up to meet more mainstream requirements?
Beginner's guide to SSL certificates
De-mystify the technology involved and give you the information you need to make the best decision when considering your online security options.