[Haskell-cafe] HSpec vs Doctest for TDD

Erik Hesselink hesselink at gmail.com
Thu Jun 26 12:44:06 UTC 2014

On Thu, Jun 26, 2014 at 2:24 PM, Bob Hutchison <hutch-lists at recursive.ca> wrote:
> On Jun 26, 2014, at 3:10 AM, Erik Hesselink <hesselink at gmail.com> wrote:
>> On Wed, Jun 25, 2014 at 5:47 PM, Michael Orlitzky <michael at orlitzky.com> wrote:
>>> On 06/25/2014 11:24 AM, Francesco Ariis wrote:
>>>> On Wed, Jun 25, 2014 at 02:45:37PM +0200, Mateusz Kowalczyk wrote:
>>>>> While I disagree with initial view that testing is useless, I certainly
>>>>> disagree with this approach too. There are plenty proof-assistants using
>>>>> type-checking to prove programs correct. That's not to say Haskell
>>>>> itself is suited for such task. If you have a type system strong enough,
>>>>> classical tests are no longer required because you can encode all the
>>>>> properties you need in types proving at compile time that your program
>>>>> is in fact correct.
>>>> For non-believers, here is a blog post that opened my eyes on the matter [1].
>>>> [1] http://lambda.jstolarek.com/2013/12/data-is-evidence/
>>> None of that helps if you write the wrong program. Your program may
>>> typecheck, but if you're expecting "42" as output and your program hums
>>> the Star Trek theme instead, the fact that it correctly does the wrong
>>> thing won't be much consolation.
>> The same goes for any kind of testing, though. All these (writing the
>> program, giving types for the program and testing the program) are
>> different ways of specifying the same thing. The benefit from doing it
>> twice in different ways, is that it's unlikely that you'll do it wrong
>> twice *in the same way*.
> So, tell me about QuickCheck… why is this thing thought so highly of? (this is a rhetorical question, I don’t need an answer :-)
> The problem isn’t really the unexpected humming of a song. It’s answering 43 when you’re expecting 42.

Are you replying to me, or Michael Orlitzky? Because I'm not sure what
point you're making. I'm not arguing against the use of tests *or*
types. I'm just saying neither is going to give you complete
guarantees, but using either one is already much better than using


More information about the Haskell-Cafe mailing list