SafeInterpretation

Companion
object
trait SafeTypes
class Object
trait Matchable
class Any
object SafeEffect
object all
object safe

Type members

Types

type Out[A] = (ThrowableEither[A], List[Throwable])

Inherited types

type _Safe[R] = Member[[A] =>> Safe[A], R]
Inherited from
SafeTypes
type _safe[R] = MemberIn[[A] =>> Safe[A], R]
Inherited from
SafeTypes

Value members

Concrete methods

def attempt[R, A](action: Eff[R, A])(implicit m: MemberInOut[[A] =>> Safe[A], R]): Eff[R, Either[Throwable, A]]

try to execute an action an report any issue

try to execute an action an report any issue

def attemptSafe[R, A](effect: Eff[R, A])(implicit m: MemberInOut[[A] =>> Safe[A], R]): Eff[R, (ThrowableEither[A], List[Throwable])]

Attempt to execute a safe action including finalizers

Attempt to execute a safe action including finalizers

def bracket[R, A, B, C](acquire: Eff[R, A])(use: A => Eff[R, B])(release: A => Eff[R, C])(implicit m: MemberInOut[[A] =>> Safe[A], R]): Eff[R, B]

get a resource A and use it. Call the release function whether an exception is thrown or not when using the resource

get a resource A and use it. Call the release function whether an exception is thrown or not when using the resource

NOTE: Eff interpreters are independent so if there is an effect short-circuiting all computations inside 'use', like Option or Either then the release function will not be called. If you want to make sure that the release function is always called "at the end of the world and whatever happens" you need to call Eff.bracketLast

def catchThrowable[R, A, B](action: Eff[R, A], pureValue: A => B, onThrowable: Throwable => Eff[R, B])(implicit m: MemberInOut[[A] =>> Safe[A], R]): Eff[R, B]

evaluate first action possibly having error effects

evaluate first action possibly having error effects

Execute a second action if the first one is not successful, based on the error

def execSafe[R, U, A](r: Eff[R, A])(implicit m: Aux[[A] =>> Safe[A], R, U]): Eff[U, ThrowableEither[A]]

run a safe effect but drop the finalizer errors

run a safe effect but drop the finalizer errors

def ignoreException[R, E <: Throwable, A](action: Eff[R, A])(implicit evidence$5: ClassTag[E], m: MemberInOut[[A] =>> Safe[A], R]): Eff[R, Unit]

ignore one possible exception that could be thrown

ignore one possible exception that could be thrown

def otherwise[R, A](action: Eff[R, A], onThrowable: Eff[R, A])(implicit m: MemberInOut[[A] =>> Safe[A], R]): Eff[R, A]

evaluate first action possibly having exceptions

evaluate first action possibly having exceptions

Execute a second action if the first one is not successful

def recoverThrowable[R, A, B](action: Eff[R, A], pureValue: A => B, onThrowable: PartialFunction[Throwable, Eff[R, B]])(implicit m: MemberInOut[[A] =>> Safe[A], R]): Eff[R, B]

evaluate first action possibly having error effects

evaluate first action possibly having error effects

Execute a second action if the first one is not successful and second is defined for the error

def runSafe[R, U, A](effect: Eff[R, A])(implicit m: Aux[[A] =>> Safe[A], R, U]): Eff[U, (ThrowableEither[A], List[Throwable])]

Run a safe effect

Run a safe effect

Collect finalizer exceptions if any

def safeInterpreter[R, A]: Interpreter[[A] =>> Safe[A], R, A, (A)]
def safeInterpreter[R, A](last: Option[(Eff[R, Unit], MemberInOut[[A] =>> Safe[A], R])]): Interpreter[[A] =>> Safe[A], R, A, (A)]
def safeMemo[R, A](key: AnyRef, cache: Cache, e: Eff[R, A])(implicit safe: MemberInOut[[A] =>> Safe[A], R]): Eff[R, A]

Memoize safe effects using a cache

Memoize safe effects using a cache

if this method is called with the same key the previous value will be returned

def thenFinally[R, A](effect: Eff[R, A], last: Eff[R, Unit])(implicit m: MemberInOut[[A] =>> Safe[A], R]): Eff[R, A]

evaluate first action possibly having error effects execute a second action whether the first is successful or not but keep track of finalizer exceptions

evaluate first action possibly having error effects execute a second action whether the first is successful or not but keep track of finalizer exceptions

def whenFailed[R, A](action: Eff[R, A], onThrowable: Throwable => Eff[R, A])(implicit m: MemberInOut[[A] =>> Safe[A], R]): Eff[R, A]

evaluate first action possibly throwing exceptions

evaluate first action possibly throwing exceptions

Execute a second action if the first one is not successful, based on the exception

The final value type is the same as the original type

def whenThrowable[R, A](action: Eff[R, A], onThrowable: PartialFunction[Throwable, Eff[R, A]])(implicit m: MemberInOut[[A] =>> Safe[A], R]): Eff[R, A]

evaluate first action possibly throwing exceptions

evaluate first action possibly throwing exceptions

Execute a second action if the first one is not successful and second is defined for the error

The final value type is the same as the original type

Inherited methods

def eval[R, A](a: Eval[A])(implicit evidence$2: _safe[R]): Eff[R, A]
Inherited from
SafeCreation
def exception[R, A](t: Throwable)(implicit evidence$3: _safe[R]): Eff[R, A]
Inherited from
SafeCreation
def finalizerException[R](t: Throwable)(implicit evidence$4: _safe[R]): Eff[R, Unit]
Inherited from
SafeCreation
def protect[R, A](a: => A)(implicit evidence$1: _safe[R]): Eff[R, A]
Inherited from
SafeCreation