From c862c7a5a7b30f6e6e6dd2c9020e297d19757ec5 Mon Sep 17 00:00:00 2001 From: Andreas Grois Date: Thu, 16 Mar 2023 21:45:25 +0100 Subject: Remaining changes needed for proper lifetime support --- src/lib.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index 6476859..73469c3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -79,7 +79,7 @@ macro_rules! free { Pure($generic), Free(Box<$f>) } - impl<$($other_lifetimes,)* $generic> $name<$($other_lifetimes,)* $generic> where $generic : $a { + impl<$($other_lifetimes : $a,)* $generic> $name<$($other_lifetimes,)* $generic> where $generic : $a { $v fn lift_f(command : <$f as $crate::higher::Functor<$a, Self>>::Target<$generic>) -> Self{ use $crate::higher::Functor; Self::Free(Box::new(command.fmap(|a| Self::Pure(a)))) @@ -94,12 +94,12 @@ macro_rules! free { } } - impl<$($other_lifetimes,)* A> $crate::higher::Functor<$a,A> for $name<$($other_lifetimes,)*A> where A : $a { + impl<$($other_lifetimes : $a,)* A> $crate::higher::Functor<$a,A> for $name<$($other_lifetimes,)*A> where A : $a { type Target = $name<$($other_lifetimes,)* T>; fn fmap(self, f: F) -> Self::Target where F: Fn(A) -> B + $a { - fn __fmap_impl<$($other_lifetimes,)* A, B, F>(s : $name<$($other_lifetimes,)* A>, f : std::rc::Rc) -> $name<$($other_lifetimes,)* B> where A : $a, F: Fn(A) -> B + $a{ + fn __fmap_impl<$($other_lifetimes : $a,)* A, B, F>(s : $name<$($other_lifetimes,)* A>, f : std::rc::Rc) -> $name<$($other_lifetimes,)* B> where A : $a, F: Fn(A) -> B + $a{ use $crate::higher::Functor; match s { $name::Pure(a) => {$name::Pure(f(a))}, @@ -118,7 +118,7 @@ macro_rules! free { } } - impl<$($other_lifetimes,)* A> $crate::higher::Apply<$a, A> for $name<$($other_lifetimes,)* A> where A: $a + Clone,{ + impl<$($other_lifetimes : $a,)* A> $crate::higher::Apply<$a, A> for $name<$($other_lifetimes,)* A> where A: $a + Clone,{ type Target = $name<$($other_lifetimes,)* T> where T:$a; fn apply( self, @@ -131,13 +131,13 @@ macro_rules! free { } } - impl<$($other_lifetimes,)* A> $crate::higher::Bind<$a,A> for $name<$($other_lifetimes,)*A> where A : $a{ + impl<$($other_lifetimes : $a,)* A> $crate::higher::Bind<$a,A> for $name<$($other_lifetimes,)*A> where A : $a{ type Target = $name<$($other_lifetimes,)* T>; fn bind(self, f: F) -> Self::Target where F: Fn(A) -> Self::Target + $a, { - fn __bind_impl<$($other_lifetimes,)* A, B, F>(s : $name<$($other_lifetimes,)*A>, f : std::rc::Rc) -> $name<$($other_lifetimes,)* B> where A : $a, F: Fn(A) -> $name<$($other_lifetimes,)* B> + $a{ + fn __bind_impl<$($other_lifetimes : $a,)* A, B, F>(s : $name<$($other_lifetimes,)*A>, f : std::rc::Rc) -> $name<$($other_lifetimes,)* B> where A : $a, F: Fn(A) -> $name<$($other_lifetimes,)* B> + $a{ use $crate::higher::Functor; match s { $name::Pure(a) => {f(a)}, -- cgit v1.2.3