- Prelude
- catchOf <E, M, A> (Func<E, K<M, A>> Fail)
- catchOfFold <E, M, A> (Func<E, K<M, A>> Fail)
- @catch <M, A> (Error error, Func<Error, K<M, A>> Fail)
- @catch <M, A> (Error error, K<M, A> Fail)
- @catch <M, A> (int errorCode, Func<Error, K<M, A>> Fail)
- @catch <M, A> (int errorCode, K<M, A> Fail)
- @catch <M, A> (Func<Error, bool> predicate, Func<Error, K<M, A>> Fail)
- @catch <M, A> (Func<Error, bool> predicate, K<M, A> Fail)
- @catch <M, A> (Func<Error, K<M, A>> Fail)
- @catch <M, A> (K<M, A> Fail)
- expected <M, A> (Func<Expected, K<M, A>> Fail)
- expectedOf <E, M, A> (Func<E, K<M, A>> Fail)
- exceptional <M, A> (Func<Exceptional, K<M, A>> Fail)
- exceptionalOf <E, M, A> (Func<E, K<M, A>> Fail)
- expectedFold <M, A> (Func<Expected, K<M, A>> Fail)
- expectedOfFold <E, M, A> (Func<E, K<M, A>> Fail)
- exceptionalFold <M, A> (Func<Exceptional, K<M, A>> Fail)
- exceptionalOfFold <E, M, A> (Func<E, K<M, A>> Fail)
- Prelude
The @catch
functions produce a CatchError
or CatchValue
type. These can be composed together with the
Aff
and Eff
monads (and maybe more in the future), to create a functional-programming equivalent to
exception catching and matching.
public class TimeoutExample<RT>
where RT : struct,
HasTime<RT>,
HasCancel<RT>,
HasConsole<RT>
{
public static Eff<RT, Unit> main =>
from _1 in timeout(60 * seconds, longRunning)
| @catch(Errors.TimedOut, unitEff)
from _2 in Console<RT>.writeLine("done")
select unit;
static Aff<RT, Unit> longRunning =>
(from tm in Time<RT>.now
from _1 in Console<RT>.writeLine(tm.ToLongTimeString())
select unit)
.ToAff()
.Repeat(Schedule.Fibonacci(1 * second));
}
method CatchM<Error, M, A> catchOf <E, M, A> (Func<E, K<M, A>> Fail) Source #
Catch all Error
errors of subtype E
and return Fail
method CatchM<Error, M, A> catchOfFold <E, M, A> (Func<E, K<M, A>> Fail) Source #
Catch all Error
errors of subtype E
and return Fail
method CatchM<Error, M, A> @catch <M, A> (Error error, Func<Error, K<M, A>> Fail) Source #
Catch an error if the error matches the argument provided
method CatchM<Error, M, A> @catch <M, A> (Error error, K<M, A> Fail) Source #
Catch an error if the error matches the argument provided
method CatchM<Error, M, A> @catch <M, A> (int errorCode, Func<Error, K<M, A>> Fail) Source #
Catch an error if the error matches the argument provided
method CatchM<Error, M, A> @catch <M, A> (int errorCode, K<M, A> Fail) Source #
Catch an error if the error matches the argument provided
method CatchM<Error, M, A> @catch <M, A> (Func<Error, bool> predicate, Func<Error, K<M, A>> Fail) Source #
Catch an error if the error matches the argument provided
method CatchM<Error, M, A> @catch <M, A> (Func<Error, bool> predicate, K<M, A> Fail) Source #
Catch an error if the error matches the argument provided
method CatchM<Error, M, A> @catch <M, A> (Func<Error, K<M, A>> Fail) Source #
Catch all errors and return Fail
method CatchM<Error, M, A> @catch <M, A> (K<M, A> Fail) Source #
Catch all errors and return Fail
method CatchM<Error, M, A> expected <M, A> (Func<Expected, K<M, A>> Fail) Source #
Catch all Expected
errors and return Fail
method CatchM<Error, M, A> expectedOf <E, M, A> (Func<E, K<M, A>> Fail) Source #
Catch all Expected
errors of subtype E
and return Fail
method CatchM<Error, M, A> exceptional <M, A> (Func<Exceptional, K<M, A>> Fail) Source #
Catch all Exceptional
errors and return Fail
method CatchM<Error, M, A> exceptionalOf <E, M, A> (Func<E, K<M, A>> Fail) Source #
Catch all errors and return Fail
method CatchM<Error, M, A> expectedFold <M, A> (Func<Expected, K<M, A>> Fail) Source #
Catch all Expected
errors and return Fail
method CatchM<Error, M, A> expectedOfFold <E, M, A> (Func<E, K<M, A>> Fail) Source #
Catch all Expected
errors of subtype E
and return Fail
method CatchM<Error, M, A> exceptionalFold <M, A> (Func<Exceptional, K<M, A>> Fail) Source #
Catch all Exceptional
errors and return Fail
method CatchM<Error, M, A> exceptionalOfFold <E, M, A> (Func<E, K<M, A>> Fail) Source #
Catch all errors and return Fail
The @catch
functions produce a CatchError
or CatchValue
type. These can be composed together with the
Aff
and Eff
monads (and maybe more in the future), to create a functional-programming equivalent to
exception catching and matching.
public class TimeoutExample<RT>
where RT : struct,
HasTime<RT>,
HasCancel<RT>,
HasConsole<RT>
{
public static Eff<RT, Unit> main =>
from _1 in timeout(60 * seconds, longRunning)
| @catch(Errors.TimedOut, unitEff)
from _2 in Console<RT>.writeLine("done")
select unit;
static Aff<RT, Unit> longRunning =>
(from tm in Time<RT>.now
from _1 in Console<RT>.writeLine(tm.ToLongTimeString())
select unit)
.ToAff()
.Repeat(Schedule.Fibonacci(1 * second));
}
method CatchM<E, M, A> @catch <E, M, A> (E error, Func<E, K<M, A>> Fail) Source #
Catch an error if the error matches the argument provided
method CatchM<E, M, A> @catch <E, M, A> (E error, K<M, A> Fail) Source #
Catch an error if the error matches the argument provided
method CatchM<E, M, A> @catch <E, M, A> (Func<E, bool> predicate, Func<E, K<M, A>> Fail) Source #
Catch an error if the error matches the argument provided