[Haskell-cafe] HSpec vs Doctest for TDD
fuuzetsu at fuuzetsu.co.uk
Wed Jun 25 12:45:37 UTC 2014
On 06/25/2014 01:56 PM, Henk-Jan van Tuyl wrote:
> On Tue, 24 Jun 2014 23:18:11 +0200, MigMit <miguelimo38 at yandex.ru> wrote:
>> Well, for me TDD seems to be a poor substitute for type safety.
>> And I specifically mean the level of type safety Haskell provides. In
>> other languages TDD could be a good thing (although I value explorative
>> programming too much), but in Haskell I think it's a waste of time.
> Type safety does not cover everything; nearly an infinite number of
> functions could be made with the type:
> f :: Int -> Int
> To paraphrase prof. Edsger W. Dijkstra:
> No amount of type checking will prove a program correct
> Henk-Jan van Tuyl
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.
More information about the Haskell-Cafe