whenIs

open fun <T> whenIs(unifier: (Substitution.Unifier) -> T? = null, fail: (Substitution.Fail) -> T? = null, otherwise: (Substitution) -> T = { throw IllegalStateException("Cannot handle solution $it") }): T

Dispatches on the concrete type of this Substitution, invoking unifier if it is a Unifier, fail if it is a Fail, or otherwise if the relevant callback was not provided (null).

Throws

if the relevant callback is null and otherwise was not overridden