Hi :slightly_smiling_face: Another FP newbie here ...
# functional
g
Hi 🙂 Another FP newbie here 😉 And one thing bothers me: what type/container should I use to represent a single value that’s neither optional nor can fail in any way, but I still want to
map
over it? I know I could use Kotlin’s
let
, but maybe there’s a proper FP way of doing this?
a
Edited: Ohhh, I misunderstood your question and Raul already answered you Original: I'm far from being an expert, but if you use Arrow lib, you can try something like
Copy code
val potentialNumber: Try<Option<Int>> = Try { Some(1) }
potentialNumber.map { maybeNumber ->
maybeNumber.map { "My number is $it" }
}
For more details, follow: https://arrow-kt.io Hope that helps 🙂