PFix

final class PFix[A, B]

PFix is a partially defined fixpoint combinator. The above "fixpoint combinator" means, PFix(h).toPartialFunction = h(PFix(h).toPartialFunction) holds for any h.

This implementation is efficient for combining multiple instances via orElse method.

Companion
object
class Object
trait Matchable
class Any

Value members

Concrete methods

def orElse(that: PFix[A, B]): PFix[A, B]

Returns a new instance combined with this and that instances.

Returns a new instance combined with this and that instances.

The result instance handles a value as using this instance as possible. If this instance cannot handle the value, then it tries to use that instance instead.

def toFunction(fallback: A => B): A => B

Converts this into a total function.

Converts this into a total function.

The result function handles a value as using this instance as possible. If this instance cannot handle the value, then it passes to the fallback function.

def toPartialFunction: PartialFunction[A, B]

Converts this into a partial function.

Converts this into a partial function.

This method is almost same as toFunction(_ => throw new MatchError), but the result implements PartialFunction correctly.