Interface Reader<C,T>

Type Parameters:
C - context type
T - value type
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Reader<C,T>
Reader monad.
  • Method Summary

    Modifier and Type
    Method
    Description
    default <R> Reader<C,R>
    flatMap(Function<? super T,Reader<C,R>> mapper)
     
    default <R> Reader<C,R>
    map(Function<? super T,? extends R> mapper)
     
    static <C, T> Reader<C,T>
    pure(T t)
    Creates Reader monad from value of type T
    run(C context)
    Reader monad is just function C -> T where C is context, T is value
  • Method Details

    • run

      T run(C context)
      Reader monad is just function C -> T where C is context, T is value
      Parameters:
      context -
      Returns:
      value of type T
    • pure

      static <C, T> Reader<C,T> pure(T t)
      Creates Reader monad from value of type T
      Type Parameters:
      C - context type
      T - value type
      Parameters:
      t - value
      Returns:
      Reader monad
    • map

      default <R> Reader<C,R> map(Function<? super T,? extends R> mapper)
    • flatMap

      default <R> Reader<C,R> flatMap(Function<? super T,Reader<C,R>> mapper)