Comment below:

On Mon, May 4, 2009 at 9:51 AM, Channing Walton <[email protected]>wrote:

>
> Hi,
> I am building a web app which has a rest API. I found that I was
> repeating myself like this:
>
> val reply:Full[XmlResponse] = req.xml match {
>  case Full(content) => {
>    a block of code that does something with the content
>    <ok/>
>  }
>  case _ => <fail/>
> }


This actually looks like a great place for map + openOr:

val reply = Full(req.xml.map({ content => ...; <ok/>}) openOr <fail />)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to