From 36e9c56959878a7da936166d1370896c43b56d8c Mon Sep 17 00:00:00 2001 From: Padraic Fanning Date: Thu, 17 Dec 2020 11:26:07 -0500 Subject: [PATCH] Minimize 52893 --- ices/52893.rs | 54 ++++++++++++++------------------------------------- 1 file changed, 15 insertions(+), 39 deletions(-) diff --git a/ices/52893.rs b/ices/52893.rs index 592d7a65..bf1a5556 100644 --- a/ices/52893.rs +++ b/ices/52893.rs @@ -1,29 +1,19 @@ -impl AddClass for Class +impl AddClass for Class where Self: At, - P: Default, - X: Entry, - T: Push<(P, F)>, - ::Data: Fn(Y) -> Class, - as At>::AtRes: Push<(P, F)>, - < as At>::AtRes as Push<(P, F)>>::PushRes: for<'this> ToRef<'this, Output=HCons> + Push, - << as At>::AtRes as Push<(P, F)>>::PushRes as Push>::PushRes: Entry + as At>::AtRes: Push, + < as At>::AtRes as Push>::PushRes: + ToRef> + Push, + << as At>::AtRes as Push>::PushRes as Push>::PushRes: + Entry, { type Output = Class; fn init(self, func: F) -> Self::Output { let builder = self.at(); - let builder = builder.push((P::default(), func)); - let output = { - let refs = builder.to_ref(); - let func = refs.head.borrow_data(); - func(refs.tail) - }; - let final_data = builder.push(output); - Class { - path: P::default(), - data: final_data.get_data() - } + let builder = builder.push(func); + let output = builder.to_ref(); + builder.push(output) } } @@ -44,7 +34,7 @@ trait Push { fn push(self, other: T) -> Self::PushRes; } -trait AddClass: At { +trait AddClass { type Output; fn init(self, func: F) -> Self::Output; @@ -52,40 +42,26 @@ trait AddClass: At { trait Entry { type Data; - - fn get_data(self) -> Self::Data; - fn borrow_data(&self) -> &Self::Data; } -impl Class { +impl Class { fn with(self, constructor: F) -> >::Output where Self: AddClass, { - self.init(constructor) + loop {} } fn from(self, constructor: F) -> >::Output where Self: AddClass, { - self.init(constructor) + loop {} } } -fn main() { - println!("Hello, world!"); -} - -/// Below structs are to bypass the original frunk requirements -pub trait HList {} -pub struct HCons { - pub head: H, - pub tail: T, -} - -pub trait ToRef<'a> { +trait ToRef { type Output; - fn to_ref(&'a self) -> Self::Output; + fn to_ref(&self) -> Self::Output; }