Diffstat (limited to 'src/walk.rs')
| -rw-r--r-- | src/walk.rs | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/src/walk.rs b/src/walk.rs index b4fdd47..b2564da 100644 --- a/src/walk.rs +++ b/src/walk.rs @@ -3,9 +3,7 @@ pub mod walkers; use core::fmt::Debug; use effectful::{ - effective::Effective, - environment::{DynBind, Environment, NativeForm}, - SendSync, + effective::{Canonical, Effective}, environment::Environment, DynBind, SendSync }; use crate::{protocol::DynVisitor, Flow}; @@ -16,7 +14,7 @@ pub trait Walk<'ctx, M, E: Environment>: Sized { type Walker: Walker<'ctx, E>; #[must_use] - fn into_walker<'e>(self) -> NativeForm<'e, Self::Walker, E> + fn into_walker<'e>(self) -> Canonical<'e, Self::Walker, E> where Self: 'e; } @@ -41,24 +39,25 @@ pub trait Walker<'ctx, E: Environment>: DynBind<E> { /// Walk the value. /// /// The walker should send data to the `visitor` as it walks the value. - fn walk<'visitor: 'effect, 'effect>( + fn walk<'visitor: 'effect, 'lt: 'effect, 'effect>( self, - visitor: DynVisitor<'visitor, 'ctx, E>, - ) -> NativeForm<'effect, Result<Self::Output, Self::Error>, E> + visitor: DynVisitor<'visitor, 'lt, 'ctx, E>, + ) -> Canonical<'effect, Result<Self::Output, Self::Error>, E> where Self: 'effect; } -pub trait WalkerObjSafe<'ctx, E: Environment>: DynBind<E> { - fn walk<'a: 'c, 'b: 'c, 'c>( +pub trait WalkerObjSafe<'lt, 'ctx: 'lt, E: Environment>: DynBind<E> + 'lt { + fn walk<'a: 'c, 'b: 'c, 'd: 'b, 'c>( &'a mut self, - visitor: DynVisitor<'b, 'ctx, E>, - ) -> NativeForm<'c, Flow, E> + visitor: DynVisitor<'b, 'd, 'ctx, E>, + ) -> Canonical<'c, Flow, E> where + 'ctx: 'd, Self: 'a; } -pub type DynWalkerObjSafe<'a, 'ctx, E> = &'a mut (dyn WalkerObjSafe<'ctx, E> + 'a); +pub type DynWalkerObjSafe<'a, 'lt, 'ctx, E> = &'a mut (dyn WalkerObjSafe<'lt, 'ctx, E> + 'lt); #[derive(SendSync)] enum DynWalkerState<'ctx, W: Walker<'ctx, E>, E: Environment> { @@ -114,16 +113,16 @@ impl<'ctx, W: Walker<'ctx, E>, E: Environment> DynWalkerAdapter<'ctx, W, E> { } } -impl<'ctx, W: Walker<'ctx, E>, E: Environment> WalkerObjSafe<'ctx, E> +impl<'lt, 'ctx: 'lt, W: Walker<'ctx, E> + 'lt, E: Environment> WalkerObjSafe<'lt, 'ctx, E> for DynWalkerAdapter<'ctx, W, E> where Self: DynBind<E>, { #[inline(always)] - fn walk<'a: 'c, 'b: 'c, 'c>( + fn walk<'a: 'c, 'b: 'c, 'd: 'b, 'c>( &'a mut self, - visitor: DynVisitor<'b, 'ctx, E>, - ) -> NativeForm<'c, Flow, E> + visitor: DynVisitor<'b, 'd, 'ctx, E>, + ) -> Canonical<'c, Flow, E> where Self: 'a, { @@ -131,7 +130,7 @@ where core::mem::replace(&mut self.state, DynWalkerState::Walking) { E::value((self, visitor)) - .update(walker, |walker, (this, visitor)| { + .update_map(walker, |walker, (this, visitor)| { // Walk the walker. walker .walk(visitor.cast()) |