Diffstat (limited to 'src/protocol/visitor/recoverable.rs')
| -rw-r--r-- | src/protocol/visitor/recoverable.rs | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/protocol/visitor/recoverable.rs b/src/protocol/visitor/recoverable.rs index 3ed49d3..4e1b307 100644 --- a/src/protocol/visitor/recoverable.rs +++ b/src/protocol/visitor/recoverable.rs @@ -1,8 +1,9 @@ use crate::{ + any::{MaybeSized, TypeName}, + bijective_higher_ranked_type, effect::{Effect, Future}, higher_ranked_type, hkt::AnySend, - nameable, protocol::{walker::hint::HintMeta, Visitor}, Flow, }; @@ -16,13 +17,21 @@ pub trait Recoverable<'ctx, E: Effect<'ctx>> { ) -> Future<'a, 'ctx, Flow, E>; } -pub type DynRecoverable<'a, 'ctx, E> = &'a mut (dyn Recoverable<'ctx, E> + Send + 'a); - -nameable! { - pub struct Name['ctx, E] for<'a>; +bijective_higher_ranked_type! { + pub type DynRecoverable['ctx][E]: MaybeSized['ctx][] + for<'a> + (dyn Recoverable<'ctx, E> + Send + 'a) + where { + E: Effect<'ctx> + } +} - impl [E] for DynRecoverable<'a, 'ctx, E> where { - E: Effect<'ctx>, +bijective_higher_ranked_type! { + pub type [][E]: TypeName[][] + for<'ctx> + (DynRecoverable<'ctx, E>) + where { + E: Effect<'ctx> } } @@ -36,7 +45,7 @@ higher_ranked_type! { pub type RecoverableKnownHkt['ctx]: (AnySend) = for<'lt> () } -impl<'a, 'ctx: 'a, E: Effect<'ctx>> HintMeta<'ctx> for DynRecoverable<'a, 'ctx, E> { +impl<'ctx, E: Effect<'ctx>> HintMeta<'ctx> for DynRecoverable<'ctx, E> { type Known = RecoverableKnownHkt<'ctx>; type Hint = (); @@ -46,7 +55,7 @@ pub fn visit_recoverable<'a, 'ctx, E: Effect<'ctx>>( visitor: Visitor<'a, 'ctx>, scope: DynRecoverableScope<'a, 'ctx, E>, ) -> Future<'a, 'ctx, Status, E> { - if let Some(object) = visitor.upcast_mut::<DynRecoverable<'_, 'ctx, E>>() { + if let Some(object) = visitor.upcast_mut::<DynRecoverable<'ctx, E>>() { // Allow the visitor to give a hint if it wants. E::map(object.visit(scope), |flow| match flow { Flow::Continue => { |