exercise 5.7 flatMap implemented
exercise 5.8 constant implemented