use of map, sequence, and state monad