Add map() and flatmap()

As discussed in #11.
At one point I was really struggling to get the compiler to recognise `flatMap` as a candidate without the type annotations. But seems to be working now... ¯\_(ツ)_/¯