reik.schatz
05/09/2019, 10:04 AMreik.schatz
05/09/2019, 10:06 AM?.let
statementsreik.schatz
05/09/2019, 10:08 AMval out: Foo? = map["key1"]?.let { one ->
map["key2"]?.let { two ->
Foo(one, two)
}
}
reik.schatz
05/09/2019, 10:09 AMreik.schatz
05/09/2019, 10:09 AMval 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)