[Haskell-beginners] Re: testing and the culture of Haskell
Stephen Tetley
stephen.tetley at gmail.com
Wed Jan 20 06:02:08 EST 2010
2010/1/20 Heinrich Apfelmus <apfelmus at quantentunnel.de>:
> Static typing is a great help, it is not uncommon for Haskell code to be
> correct on the first try once you convinced GHC that it's type correct.
> There is much less need for TDD than in other languages.
Ah, maybe the type checker is given all credit here, when perhaps it
should be shared?
With functional programming languages you are largely programming with
expressions - Scheme has the (begin ... ...) form for sequencing and
ML has sequence control structure (;), but there is simply less
control flow in typical functional programs than imperative ones
(there is also less use of assignment but that's hardly news of
course).
Figuratively speaking, functional programs have 'fewer movable parts'
to go wrong (vis-a-vis incrementing variable for loop indexes etc.
whereas map, fold, unfold, ... can be written once and used anywhere),
hence static-typing + control-flow reduction (+ limited use of side
effects) hopefully leads to first-time correctness.
Best wishes
Stephen
More information about the Beginners
mailing list