fold

inline fun <L, R, T> Either<L, R>.fold(ifLeft: (left: L) -> T, ifRight: (right: R) -> T): T

Transform this Either into a value of type T via specialized mapping functions for both left and right values

Parameters

L

The current type of left value

R

The current type of right value

T

The type of output value

ifLeft

A function for converting L values to T

ifRight

A function for converting R values to T