Even with the predominance of Box and Option monads, we still need to check for null values ββhere and there. The best I've come up with so far is to use Box # !! Method:
(Box !! possiblyNull).map(_.toString).openOr("")
Is there a better way to do this? I tried using the Box application method:
Box(possiblyNull).map(_.toString).openOr("")
But the compiler complained of an ambiguous reference to the overloaded definition, in particular:
[InType,OutType](value: InType) (pf: PartialFunction[InType,OutType])net.liftweb.common.Box[OutType]
I'm not sure why this happened, but I was hoping there would be a shorter and more concise way of saying, βGive me the meaning of this line or simply.β I was considering using tryo, but thought it was wasteful to handle the exception when it could be avoided.
Collin
source share