whenIs

abstract fun <T> whenIs(    yes: (Solution.Yes) -> T? = null,     no: (Solution.No) -> T? = null,     halt: (Solution.Halt) -> T? = null,     otherwise: (Solution) -> T = { throw IllegalStateException("Cannot handle solution $it") }): T