In Arrow Optics, is there an equivalent of 'lift' ...
# arrow
l
In Arrow Optics, is there an equivalent of 'lift' but just to get the value? I have something like
val getId: (MyClass) -> String? = MyClass.somePath.id::getOrNull
, which works, but I would prefer to call a method instead of
::getOrNull
to return a lambda directly so I don't have to explicit the variable type.
s
l
But
lift
generates a function to modify the source right? I want to generate a function to get the value in the source
s
Oh I see. I'm sorry. Then I think your best best would be to work with
::getOrNull
. I'm not sure what you mean with
to explicit the variable type
. Is it not simply returning
(MyClass) -> String?
?
l
No, it returns a
KFunction1<MyClass, String?>
. I just assumed I couldn't use it as a lambda but I guess I can. Thanks for the help