  onError: (e: unknown) => E,
): ReaderEither<S, E, A> => {
  try {
    return R.of(E.right(f()));
  } catch (e) {
    return R.of(E.left(onError(e)));
  }
};

export const fromEither = <S, E, A>(
  ta: E.Either<E, A>,
): ReaderEither<S, E, A> => R.of(ta);
