Flattening Scala Play Controllers with For Comprehensions and Eithers

It's been a little over a year since I've started programming in Scala professionally - so I wanted to come back to this blog and focus on a Scala centric post with some real world application.

I have found that some of the Play controller code I need to write can get very pyramid-shaped in nature, since most of the steps that interact with IO return options, which need to send sensible error messages back to the client in the case of `None`. Let's take a look at a contrived example function:

Read More