Posts tagged haskell

Better IO testing through Monads

:: haskell, monads, type classes, testing

Unit Testing is a great way to try to verify consistent functionality over the life of our code. Typically we design our tests to cover ranges and edge cases of our code making sure that we can handle all inputs. This is made easy when we write in Functional Languages as there (should be) no side effects. But when you want to deal with IO and side affect code in Haskell, this becomes much more difficult.

This problem has been fixed many times, but often with very complex solutions. Let’s see if we can make it really simple (even if the post is long).

Haskell Project: Unit Testing with Hspec

:: haskell, tutorial, hspec, testing

Up to this point we have written some code, explained type classes, and done a little pattern matching. But we haven’t written anything that really does anything. Until we have some IO to perform, we will have to find another way to interact with our code. This is a perfect chance to introduce Unit Testing.

Haskell Project: Show, Compare, and Filter

:: haskell, tutorial

Now that we have a few basic types we should start working on making their interaction nicer. It is pretty important to be able to print and compare data types so we will start there. Once we are able to compare, we should be able to filter lists of data types.

Haskell Project: Stack and Data Types

:: haskell, tutorial, stack

To work on my Haskell skills I decided to work on a little side project. I didn’t want something too complicated but I did want to try out some of the more fun and interesting tasks that Haskell does well.

As I work on the project I’ll go through the code, as a sort of tutorial on creating an actual application.