class Fun {

    public static <M, R> Supplier<M>
    composeTry0(final @NotNull Function<? super R, ? extends M> monadUnit,
                final @NotNull Supplier<? extends M> monadZero,
                final @NotNull ThrowingSupplier<? extends R> mayThrowOnGet,
                final @Nullable Consumer<? super Exception> onError) {
        final Consumer<? super Exception> consumeError = onError != null
                ? onError
                : t -> {
        };

        return () -> {
            try {
                return monadUnit.apply(mayThrowOnGet.tryGet());
            } catch (final Exception error) {
                consumeError.accept(error);
                return monadZero.get();
            }
        };
    }

    private  Fun();

}