Hi everyone,
For the – probably many – who never heard about it, play-monadic-actions is a small DSL that allows to write most actions as a single for-comprehension, like so:
def orderBeer() = Action.async {
for {
beerOrder <- beerOrderForm.bindFromRequest() ?| (formWithErrors => BadRequest(views.html.orderBeer(formWithErrors))
user <- findAdultUser(beerOrder.userId) ?| (notAnAdultUser => Conflict(displayError(notAnAdultUser))
beer <- sellBeer(beerOrder.beerName, user) ?| (noSuchBeer => NotFound(displayError(noSuchBeer))
} yield Ok(displayBeer(beer))
}
It also provide compatibility modules for cats and scalaz (allowing for example to use cats.Validated or scalaz.Validation with the DSL).
Today we've published version 2.1.0 which is compatible with Play 2.3.x up to 2.6.x and is cross-published for Scala 2.11 and 2.12.
Your feedback is much appreciated :).
Cheers
Valentin