[Haskell-cafe] Testing for valid data
nowgate at yahoo.com
Sat Mar 27 17:42:55 EDT 2010
Good point, but I think it side-steps the question. Haskell coughs on a data value. Do we grep our data, finding and fixing the offender, or build extensive data tests into our application code?
--- On Sat, 3/27/10, Ketil Malde <ketil at malde.org> wrote:
From: Ketil Malde <ketil at malde.org>
Subject: Re: [Haskell-cafe] Testing for valid data
To: haskell-cafe at haskell.org
Date: Saturday, March 27, 2010, 5:20 PM
michael rice <nowgate at yahoo.com> writes:
> When I'm learning a new language I like to translate old programs into
> the new language as a test of my understanding. However, many of the
> old programs are from old programming texts, many written in the time
> of punch-cards for batch processing, and many containing significant
> amounts of code that only tests for valid data. Should we still be
> writing programs in this fashion, or acknowledge the fact that better
> tools for pre-screening data are now available and code only for the
> problem at hand?
Hm - I remember test suites in a dynamically typed program with test
case upon test case checking that functions expecting integers would
throw an exception when given a string, and so on. Doesn't seem that
long ago either..
I think the whole -- well, no, but half, maybe -- point of Haskell is
that the static type system proves data validity throughout the
program. And half the trick of writing correct programs is to design
your data types to constrain the possible values to valid ones.
If I haven't seen further, it is by standing in the footprints of giants
Haskell-Cafe mailing list
Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe