Testing in Haskell
In Haskell, we'd like to think that whenever our code compiles, it works the way we way it to. Granted, this is more true in Haskell than most any other programming language! But of course there's always more work to do. An important part of any language is learning how to write tests. In this series, we'll explore a few of the most common testing libraries in Haskell. We'll also cover some of the basic paradigms around integrating testing into our development workflow.
Part 1 of this series introduces the notion of test driven development. This is the idea that before we write ANY of our source code, we should focus on writing out test cases. This way, we know that once all our test cases pass, we're good to go! We'll also see some basic Haskell testing libraries in action here, so we understand the basic mechanics.
Getting our code to give correct output is often only half the battle though! If our code is too slow, or uses too much memory, it won't be as useful! This means we need to learn how to test the performance of our code and identify any deficient areas. Find out how in part 2 of the series!
In the last part, we discovered just how deficient our naive implementation was, thanks to our benchmarks. In part 3, we'll explore various tweaks we can make to solve these problems and get our code running quickly!
This series goes over some cool libraries and techniques. But if you don't know how to combine these pieces together, they aren't very helpful! I use the Haskell Stack tool for all my project organization needs. You can learn how to use it by taking our free Stack mini-course! This will help you integrate all your new knowledge about testing libraries!