[ANN] play-monadic-actions 2.1.0

20 views
Skip to first unread message

Valentin Kasas

unread,
Aug 14, 2017, 7:07:32 PM8/14/17
to Play Framework
Hi everyone, 

It's been quite a long time since I first announced the release of play-monadic-actions (see there).

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
Reply all
Reply to author
Forward
0 new messages