Add map() and flatmap()

As discussed in #11.
Is the type annotation on the constant required?