diff --git a/src/core/transform.rs b/src/core/transform.rs index 24f80bf..3d97303 100644 --- a/src/core/transform.rs +++ b/src/core/transform.rs @@ -3,9 +3,9 @@ use crate::core::hkp::HKP; pub trait Transform<'a, A>: HKP<'a> { type This: HKP<'a>; - fn from_hkp(a: >::T) -> Self::T; + fn hkp_to_self(a: >::T) -> Self::T; - fn from_self(a: Self::T) -> >::T; + fn self_to_hkp(a: Self::T) -> >::T; fn to_hkp(self) -> >::T; } diff --git a/src/specs/applicative.rs b/src/specs/applicative.rs index 0a78076..516c9ab 100644 --- a/src/specs/applicative.rs +++ b/src/specs/applicative.rs @@ -20,7 +20,7 @@ pub mod infix { type TL: Applicative<'a, B>; fn pure(a: B) -> Self::T { - Self::from_hkp(Self::This::pure(a)) + Self::hkp_to_self(Self::This::pure(a)) } fn apply(self, mf: Self::T) -> Self::T @@ -29,7 +29,10 @@ pub mod infix { MAP: Fn(A) -> B, Self: Sized, { - Self::from_hkp(Self::This::apply(Self::from_self::(mf), self.to_hkp())) + Self::hkp_to_self(Self::This::apply( + Self::self_to_hkp::(mf), + self.to_hkp(), + )) } } } diff --git a/src/specs/bind.rs b/src/specs/bind.rs index c49231f..bd9f84f 100644 --- a/src/specs/bind.rs +++ b/src/specs/bind.rs @@ -23,8 +23,8 @@ pub mod infix { type TL: Bind<'a, B>; fn join(mma: Self::T>) -> Self::T { - Self::from_hkp(Self::This::bind(Self::from_self(mma), |a| { - Self::from_self::(a) + Self::hkp_to_self(Self::This::bind(Self::self_to_hkp(mma), |a| { + Self::self_to_hkp::(a) })) } @@ -33,8 +33,8 @@ pub mod infix { BIND: Fn(A) -> Self::T + 'a, Self: Sized, { - Self::from_hkp(Self::This::bind(self.to_hkp(), move |a| { - Self::from_self::(mf(a)) + Self::hkp_to_self(Self::This::bind(self.to_hkp(), move |a| { + Self::self_to_hkp::(mf(a)) })) } } diff --git a/src/specs/functor.rs b/src/specs/functor.rs index 5650b7e..3aa2b29 100644 --- a/src/specs/functor.rs +++ b/src/specs/functor.rs @@ -19,7 +19,7 @@ pub mod infix { MAP: Fn(A) -> B + 'a, Self: Sized, { - Self::from_hkp(Self::This::map(f, self.to_hkp())) + Self::hkp_to_self(Self::This::map(f, self.to_hkp())) } } } diff --git a/src/specs/monad.rs b/src/specs/monad.rs index 9a74682..4d8bed8 100644 --- a/src/specs/monad.rs +++ b/src/specs/monad.rs @@ -17,12 +17,12 @@ pub mod infix { type TL: Monad<'a, B>; fn returns(b: B) -> Self::T { - Self::from_hkp(Self::This::returns(b)) + Self::hkp_to_self(Self::This::returns(b)) } fn join(mma: Self::T>) -> Self::T { - Self::from_hkp(::bind(Self::from_self(mma), |a| { - Self::from_self::(a) + Self::hkp_to_self(::bind(Self::self_to_hkp(mma), |a| { + Self::self_to_hkp::(a) })) } @@ -31,8 +31,8 @@ pub mod infix { BIND: Fn(A) -> Self::T + 'a, Self: Sized, { - Self::from_hkp(::bind(self.to_hkp(), move |a| { - Self::from_self::(mf(a)) + Self::hkp_to_self(::bind(self.to_hkp(), move |a| { + Self::self_to_hkp::(mf(a)) })) } } diff --git a/src/standard/either.rs b/src/standard/either.rs index f47f914..b1c39bb 100644 --- a/src/standard/either.rs +++ b/src/standard/either.rs @@ -75,11 +75,11 @@ mod infix { impl<'a, L, R: 'a> Transform<'a, R> for Either { type This = EitherK; - fn from_hkp(a: >::T) -> Self::T { + fn hkp_to_self(a: >::T) -> Self::T { a } - fn from_self(a: Self::T) -> >::T { + fn self_to_hkp(a: Self::T) -> >::T { a } diff --git a/src/standard/identity.rs b/src/standard/identity.rs index 0431460..c776bcc 100644 --- a/src/standard/identity.rs +++ b/src/standard/identity.rs @@ -60,11 +60,11 @@ pub mod infix { impl<'a, A: 'a> Transform<'a, A> for Identity { type This = IdentityK; - fn from_hkp(a: >::T) -> Self::T { + fn hkp_to_self(a: >::T) -> Self::T { a } - fn from_self(a: Self::T) -> >::T { + fn self_to_hkp(a: Self::T) -> >::T { a } diff --git a/src/standard/option.rs b/src/standard/option.rs index 0554dc1..ee184bb 100644 --- a/src/standard/option.rs +++ b/src/standard/option.rs @@ -62,11 +62,11 @@ pub mod infix { impl<'a, A: 'a> Transform<'a, A> for Option { type This = OptionK; - fn from_hkp(a: >::T) -> Self::T { + fn hkp_to_self(a: >::T) -> Self::T { a } - fn from_self(a: Self::T) -> >::T { + fn self_to_hkp(a: Self::T) -> >::T { a } diff --git a/src/standard/result.rs b/src/standard/result.rs index 6a4924f..a6cc3e5 100644 --- a/src/standard/result.rs +++ b/src/standard/result.rs @@ -66,11 +66,11 @@ mod infix { impl<'a, A: 'a, E> Transform<'a, A> for Result { type This = ResultK; - fn from_hkp(a: >::T) -> Self::T { + fn hkp_to_self(a: >::T) -> Self::T { a } - fn from_self(a: Self::T) -> >::T { + fn self_to_hkp(a: Self::T) -> >::T { a } diff --git a/src/standard/vec.rs b/src/standard/vec.rs index 55ecb67..c5593a8 100644 --- a/src/standard/vec.rs +++ b/src/standard/vec.rs @@ -65,11 +65,11 @@ pub mod infix { impl<'a, A: 'a> Transform<'a, A> for Vec { type This = VecK; - fn from_hkp(a: >::T) -> Self::T { + fn hkp_to_self(a: >::T) -> Self::T { a } - fn from_self(a: Self::T) -> >::T { + fn self_to_hkp(a: Self::T) -> >::T { a }