A Simple TDD Environment in Haskell
See the original posting on DZone Python
I recently implemented the bowling kata in Haskell. In the process, I found out how set up my environment to comfortably do Test Driven Development. Hopefully, others might find this post helpful to begin their journey with the language. I used the following components:
- Haskell installation: Haskell Platform. This also gives you GHCi which you can use as an interactive environment and type inspector.
- IDE: Any editor would suffice, but I used Visual Studio Code as they have an extension for Haskell that gave me some basic IntelliSense features.
- Test libraries: Hspec, which is based on RSpec. This can be installed using Haskell’s package manager, cabal, from the command line with
cabal install hspec.
- Helper libraries: Printf for colourful command line output.
Using the example from Hspec’s documentation, I began with this structure for my code: