Adding the code, which seems to play nicely..
Adding a playground with some test data to play with in GHCI.