reik.schatz
05/09/2019, 10:04 AM?.let
statementsval out: Foo? = map["key1"]?.let { one ->
map["key2"]?.let { two ->
Foo(one, two)
}
}
val foo = for {
one <- map["key1"]
two <- map["key2"]
} yield Foo(one, two)
robstoll
05/09/2019, 10:10 AMlet
are similar to the nested flatMap
which the for comprehension hidesreik.schatz
05/09/2019, 10:13 AMkartoffelsup
05/09/2019, 11:18 AMreik.schatz
05/09/2019, 11:47 AMstreetsofboston
05/09/2019, 12:08 PMfx
(they exist for a bunch of monadic types, eg Option, Either, IO, etc)