[Haskell-beginners] is Haskell practical?

Henk-Jan van Tuyl hjgtuyl at chello.nl
Fri Nov 27 19:34:12 UTC 2015

On Wed, 25 Nov 2015 13:37:30 +0100, Dennis Raddle
<dennis.raddle at gmail.com> wrote:

> But what if someone came along and said, "Well, conciseness isn't all  
> that
> important. Having to type more isn't much of a drawback -- it doesn't
> really increase the time it takes to write a program once you consider  
> that
> there is a greater time spent in requirements collection, overall design,
> debugging, and documentation. The real drawback of concise/expressive
> Haskell is the difficulty in understanding and using it fluently.
> Ultimately Haskell is just mathematicians having fun, but not very
> practical."

It is not just the amount of work with the keyboard; it also takes more  
time thinking about details if you don't have the conciseness of Haskell.  
More necessary thinking and typing leads to more bugs, software  
engineering books talk about the number of bugs per 1000 lines of code  
being constant, independent of the level of the language.

Take for instance the memory allocation in C:
  - you have to remember which macro you defined for the buffer size
  - check your input if it doesn't overflow your buffer
  - remember to free the memory at the right point(s) in your program
  - check that you don't use the pointer after the buffer has been freed
The automatic memory allocation in Haskell doesn't just save you the  
typing for allocation and freeing, it saves a lot of thinking and  
checking. It prevents a lot of bugs and therefore, it saves testing and  
debugging  time. Similar things can be said about other things that make  
Haskell programs more compact.

There are other advantages when using Haskell, e.g.
  - better modularity, see the paper "Why functional programming matters"[0]
  - guaranteed pure functions make it easier to reason about the code.
You can find more at the Haskell site[1].

Henk-Jan van Tuyl

[0] http://www.cse.chalmers.se/~rjmh/Papers/whyfp.pdf

Folding at home
What if you could share your unused computer power to help find a cure? In
just 5 minutes you can join the world's biggest networked computer and get
us closer sooner. Watch the video.

More information about the Beginners mailing list