From 7ac9ee1bec2c35e8d87b4e402e28b60243e7125d Mon Sep 17 00:00:00 2001 From: timofey Date: Sun, 18 Jun 2023 14:42:44 +0000 Subject: [PATCH] remove `avl::context` --- src/rstd/collections/avl.rs | 1 - src/rstd/collections/avl/context.rs | 71 ----------------------------- 2 files changed, 72 deletions(-) delete mode 100644 src/rstd/collections/avl/context.rs diff --git a/src/rstd/collections/avl.rs b/src/rstd/collections/avl.rs index 99cdaa2..a3dc729 100644 --- a/src/rstd/collections/avl.rs +++ b/src/rstd/collections/avl.rs @@ -1,5 +1,4 @@ pub mod binary; -pub mod context; use std::{error::Error, fmt::Display, rc::Rc}; diff --git a/src/rstd/collections/avl/context.rs b/src/rstd/collections/avl/context.rs deleted file mode 100644 index db94f6e..0000000 --- a/src/rstd/collections/avl/context.rs +++ /dev/null @@ -1,71 +0,0 @@ -use std::marker::PhantomData; - -use crate::{ - flow::{binary::*, comparator::*}, - func::context::*, - rstd::fallible::*, -}; - -use super::{binary::*, *}; - -struct AvlTrees(Rc, PhantomData); - -impl AvlTrees { - fn new(comparator: Rc) -> Self { - Self(comparator, PhantomData) - } -} - -impl<'a, Ctx: Context<'a>, A: Mentionable<'a, Ctx> + Clone, C: 'a + Comparator> Clone - for AvlTrees -{ - fn clone(&self) -> Self { - Self::new(self.0.clone()) - } -} - -impl<'a, Ctx: Context<'a>, A: Mentionable<'a, Ctx> + Clone, C: 'a + Comparator> - FunctorContext<'a> for AvlTrees -{ - type T = FallibleMonad< - 'a, - Ctx, - ResolutionError>>>, - >; -} - -impl<'a, Ctx: Context<'a>, A: Mentionable<'a, Ctx> + Clone, C: 'a + Comparator> BinaryTrees<'a> - for AvlTrees -{ - type Node = AvlNode<'a, Ctx, A>; - - type Reference = AvlReference<'a, Ctx, A>; - - type Tree = AvlTree<'a, Ctx, A>; - - type Key = A; - - type Comparator = C; - - type _Tm = Self::T; - - fn comparator(&self) -> &Self::Comparator { - &self.0 - } - - fn split(&self, node: &Self::Node) -> Split<'a, Self> { - (node.l.clone(), node.r.clone(), node.key.clone()) - } - - fn resolve(&self, reference: &Self::Reference) -> BTWrap<'a, Self, Self::Node> { - Self::fmap(Ctx::stuff(reference.resolve()), |rc| rc.as_ref().clone()) - } - - fn equal(&self, rl: &Self::Reference, rr: &Self::Reference) -> bool { - rl == rr - } - - fn refer(&self, tree: &Self::Tree) -> Option { - tree.reference() - } -}