Provide some interface or API for providing a conversion from type A to type B so that when A is disptached, an instance of B will be dispatched to handlers, either in addition to or in lieu of.
Use case
// pins the types that can be assigned to outcome instead of just "object"
Either<Some.Success, Some.Error> outcome = await doWork();
_dispatcher.Dispatch(outcome)
// wouldn't disptached Either<A, B>, but would unwrap
// the either and dispatch the underlying value.
Some ideas
public interface IDispatchTransformer
{
public bool AppliesTo(object obj);
public bool ReplacesOriginal { get; }
public object Transform(object obj);
}
Provide some interface or API for providing a conversion from type A to type B so that when A is disptached, an instance of B will be dispatched to handlers, either in addition to or in lieu of.
Use case
Some ideas