Class FromLeft


  • public class FromLeft
    extends PrimitiveFunction
    Extract the Left value from an Either, or return a default value.
    • Field Detail

      • NAME

        public static final Name NAME
    • Constructor Detail

      • FromLeft

        public FromLeft()
    • Method Detail

      • name

        public Name name()
        Description copied from class: PrimitiveFunction
        The unique name of the primitive function.
        Specified by:
        name in class PrimitiveFunction
        Returns:
        the name of this primitive function
      • implementation

        protected java.util.function.Function<java.util.List<Term>,​java.util.function.Function<Context,​java.util.function.Function<Graph,​Either<InContext<Error_>,​Term>>>> implementation()
        Description copied from class: PrimitiveFunction
        A dynamic/interpreted implementation of the function. Subclasses implement this with Either-based logic.
        Specified by:
        implementation in class PrimitiveFunction
        Returns:
        the function implementation
      • apply

        @Deprecated
        public static <A,​B> A apply​(A defaultValue,
                                          Either<A,​B> either)
        Deprecated.
        Use applyLazy(Supplier, Either) instead. Eager evaluation of the default wastes memory.
      • applyLazy

        public static <A,​B> A applyLazy​(java.util.function.Supplier<A> defaultValue,
                                              Either<A,​B> either)
        Lazily extract the Left value from an Either, or return a default value if it is a Right. The default is only evaluated if the Either is a Right.