Work on orienting positions for attachment items

This commit is contained in:
2024-10-02 00:30:52 +01:00
parent 8df6b31062
commit 7ce5225491
10 changed files with 314 additions and 161 deletions
+28
View File
@@ -40,6 +40,34 @@ data LabelDoubleTree b a = LDT {_ldtValue :: a, _ldtLeft :: [(b,LabelDoubleTree
,_ldtRight :: [(b,LabelDoubleTree b a)]}
deriving (Eq,Ord,Show,Read)
-- I am not sure about the double use of records here
data ContextLDT b a = TopLDT
{ _cldtValue :: a}
| LeftwardLDT
{ _cldtUp :: ContextLDT b a
, _cldtCloseLeft :: [LabelDoubleTree b a]
, _cldtLink :: b
, _cldtValue :: a
, _cldtCloseRight :: [LabelDoubleTree b a]
, _cldtFarRight :: [LabelDoubleTree b a]
}
| RightwardLDT
{ _cldtUp :: ContextLDT b a
, _cldtFarLeft :: [LabelDoubleTree b a]
, _cldtCloseLeft :: [LabelDoubleTree b a]
, _cldtLink :: b
, _cldtValue :: a
, _cldtCloseRight :: [LabelDoubleTree b a]
}
-- this is not quite right, it duplicates the value when the context is at the
-- top
data LocationLDT b a = LocLDT
{ _locLdtContext :: ContextLDT b a
, _locLdtLeft :: [LabelDoubleTree b a]
, _locLdtRight :: [LabelDoubleTree b a]
}
instance Functor DoubleTree where
fmap f (DT x l r) = DT (f x) (fmap (fmap f) l) (fmap (fmap f) r)