Eric O'Connell
07/12/2019, 7:57 PMfun <T, R> Optional<T>.mapDefault(default: R, mapper: (T) -> R): R and call it with a default of a subtype of a sealed class e.g. maybeThing.mapDefault(Action.NoFoo) { thing -> Action.Foo } then this fails type checking because R in mapDefault is bound to Action.NoFoo — is there a good way around this besides calling maybeThing.mapDefault<Thing, Action> ?streetsofboston
07/12/2019, 7:59 PMstreetsofboston
07/12/2019, 8:00 PMfun <T, S, D : S, R : S> Optional<T>.mapDefault(default: D, mapper: (T) -> R): SEric O'Connell
07/12/2019, 8:06 PMEric O'Connell
07/12/2019, 8:06 PM