I've a function that returns an Option. How do I turn it into a box.
I'm told there are implicit functions to do so, so why doesn't the
following code work and what do I need to do to it please?
import net.liftweb.util.{Failure, Full, Box}
def myOpt(hasSome: boolean) = {
if (hasSome)
Some("got it")
else
None
}
val noFailure = myOpt(true) ?~ "shouldn't see me"
println(noFailure)
val aFailure = myOpt(false) ?~ "should fail"
println(aFailure)
Tim
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---