``` val intentions = ui.intentions() ...
# rx
z
Copy code
val intentions = ui.intentions()
                .map {
                    fun handleUiInput(intention: Intention): Unit = when (intention) {
                        is Intention.BooleanPreferenceWithChange -> {
                            intention.preference.db.set(newValue = intention.change)
                        }
                        is Intention.NumberPreferenceWithChange -> {
                            taxDb.write(intention.change)
                        }
                    }
                    handleUiInput(it)
                }
is there any better way to do a compile time type-safe
when
over a
sealed class
in an rx stream?
1
p
zak.taccardi: why do you declare a function and execute it immediate?
z
for the compile-time type safety of the
when
statement
l
val <A> A.safe: Unit get() = Unit
so you can
when(). {}.safe
z
I don't get what you're saying at all @lupajz
p
zak.taccardi: what's not compile time safe when you don't do that?