kioba
10/12/2020, 6:14 PMoption { } continuation for nullable types similar to either {}?raulraja
10/12/2020, 6:22 PMkioba
10/12/2020, 6:53 PMeither{} implementationilaborie
10/12/2020, 8:09 PMimport arrow.core.None
import arrow.core.Option
import arrow.core.Some
private object NoneException : RuntimeException()
class OptionDsl {
fun <T> Option<T>.bind(): T =
if (this is Some) this.t
else throw NoneException
}
fun <T> option(block: OptionDsl.() -> T): Option<T> =
try {
OptionDsl().block().let(::Some)
} catch (_: NoneException) {
None
}raulraja
10/12/2020, 11:11 PMraulraja
10/12/2020, 11:11 PMraulraja
10/12/2020, 11:12 PMraulraja
10/12/2020, 11:13 PMraulraja
10/12/2020, 11:14 PMraulraja
10/12/2020, 11:15 PMraulraja
10/12/2020, 11:21 PMraulraja
10/12/2020, 11:22 PMilaborie
10/13/2020, 5:49 AMkioba
10/14/2020, 2:40 PMDelimitedScope<A?> with shift and how it works under the hood in arrow-continuations.
Am I correct that we are not able to get rid of the BindingSyntax with `DelimitedScope`❓
for some reason I was under the impression that it will be possible in some ways but probably we would need meta for that 😅raulraja
10/14/2020, 6:54 PM