DoubleTree -> DTree

This commit is contained in:
2025-07-10 11:28:55 +01:00
parent e013bd57f7
commit a9d730a5c1
3 changed files with 25 additions and 25 deletions
+11 -11
View File
@@ -28,7 +28,7 @@ data LabelDoubleTreeNodeType a
| LDTMidBelowNode a
| LDTBottomNode a
data DoubleTree a = DT {_dtValue :: a, _dtLeft :: [DoubleTree a], _dtRight :: [DoubleTree a]}
data DTree a = DT {_dtValue :: a, _dtLeft :: [DTree a], _dtRight :: [DTree a]}
deriving (Eq, Ord, Show, Read)
data LDTree b a = LDT -- LabelDoubleTree
@@ -63,10 +63,10 @@ data LocationLDT b a = LocLDT
, _locLDT :: LDTree b a
}
instance Functor DoubleTree where
instance Functor DTree where
fmap f (DT x l r) = DT (f x) (fmap (fmap f) l) (fmap (fmap f) r)
instance Foldable DoubleTree where
instance Foldable DTree where
foldMap f (DT x l r) = foldMap (foldMap f) l <> f x <> foldMap (foldMap f) r
instance Functor (LDTree b) where
@@ -85,25 +85,25 @@ data ContextDT a
= TopDT
| LeftwardDT
{ _cdtUp :: ContextDT a
, _cdtCloseLeft :: [DoubleTree a]
, _cdtCloseLeft :: [DTree a]
, _cdtParent :: a
, _cdtCloseRight :: [DoubleTree a]
, _cdtFarRight :: [DoubleTree a]
, _cdtCloseRight :: [DTree a]
, _cdtFarRight :: [DTree a]
}
| RightwardDT
{ _cdtUp :: ContextDT a
, _cdtFarLeft :: [ DoubleTree a]
, _cdtCloseLeft :: [DoubleTree a]
, _cdtFarLeft :: [ DTree a]
, _cdtCloseLeft :: [DTree a]
, _cdtParent :: a
, _cdtCloseRight :: [DoubleTree a]
, _cdtCloseRight :: [DTree a]
}
data LocationDT b a = LocDT
{ _locDtContext :: ContextDT a
, _locDT :: DoubleTree a
, _locDT :: DTree a
}
makeLenses ''DoubleTree
makeLenses ''DTree
makeLenses ''LDTree
makeLenses ''LocationLDT
makeLenses ''ContextLDT