diff options
| author | Andreas Grois <andi@grois.info> | 2023-03-16 21:45:25 +0100 |
|---|---|---|
| committer | Andreas Grois <andi@grois.info> | 2023-03-16 21:45:25 +0100 |
| commit | c862c7a5a7b30f6e6e6dd2c9020e297d19757ec5 (patch) | |
| tree | 64b67624fded1c89534487720033f4706367fe16 /src | |
| parent | 36844aa97ef56cc542b1532e2fb7afcd42e4d789 (diff) | |
Remaining changes needed for proper lifetime support
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib.rs | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -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<T> = $name<$($other_lifetimes,)* T>; fn fmap<B,F>(self, f: F) -> Self::Target<B> where F: Fn(A) -> B + $a { - fn __fmap_impl<$($other_lifetimes,)* A, B, F>(s : $name<$($other_lifetimes,)* A>, f : std::rc::Rc<F>) -> $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<F>) -> $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<T> = $name<$($other_lifetimes,)* T> where T:$a; fn apply<B>( 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<T> = $name<$($other_lifetimes,)* T>; fn bind<B, F>(self, f: F) -> Self::Target<B> where F: Fn(A) -> Self::Target<B> + $a, { - fn __bind_impl<$($other_lifetimes,)* A, B, F>(s : $name<$($other_lifetimes,)*A>, f : std::rc::Rc<F>) -> $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<F>) -> $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)}, |
