I saw Scala.Option library but couldn’t find it there. Do I have to write lift with map instead?
You can do this:
def liftOptionFun[A, B](f: A => B): Option[A] => Option[B] = _.map(f) val f: Int => Int = _ + 1 val ff: Option[Int] => Option[Int] = liftOptionFun(f)
Or if using cats you can do this:
import cats.Functor val f: Int => Int = _ + 1 val ff: Option[Int] => Option[Int] = Functor[Option].lift(f)