Migrate LDTs to DTs
This commit is contained in:
@@ -98,7 +98,7 @@ data ContextDT a
|
||||
, _cdtCloseRight :: [DTree a]
|
||||
}
|
||||
|
||||
data LocationDT b a = LocDT
|
||||
data LocationDT a = LocDT
|
||||
{ _locDtContext :: ContextDT a
|
||||
, _locDT :: DTree a
|
||||
}
|
||||
@@ -107,10 +107,15 @@ makeLenses ''DTree
|
||||
makeLenses ''LDTree
|
||||
makeLenses ''LocationLDT
|
||||
makeLenses ''ContextLDT
|
||||
makeLenses ''LocationDT
|
||||
makeLenses ''ContextDT
|
||||
|
||||
instance Functor (LocationLDT b) where
|
||||
fmap f (LocLDT c t) = LocLDT (fmap f c) (fmap f t)
|
||||
|
||||
instance Functor (LocationDT) where
|
||||
fmap f (LocDT c t) = LocDT (fmap f c) (fmap f t)
|
||||
|
||||
instance Functor (ContextLDT b) where
|
||||
fmap f = \case
|
||||
TopLDT -> TopLDT
|
||||
@@ -128,5 +133,20 @@ instance Functor (ContextLDT b) where
|
||||
l
|
||||
(fmap (fmap (fmap f)) cr)
|
||||
|
||||
instance Functor (ContextDT) where
|
||||
fmap f = \case
|
||||
TopDT -> TopDT
|
||||
LeftwardDT u cl p cr fr -> LeftwardDT
|
||||
(fmap f u)
|
||||
(fmap (fmap ( f)) cl)
|
||||
(f p)
|
||||
(fmap (fmap ( f)) cr)
|
||||
(fmap (fmap ( f)) fr)
|
||||
RightwardDT u fl cl p cr -> RightwardDT (fmap f u)
|
||||
(fmap (fmap ( f)) fl)
|
||||
(fmap (fmap ( f)) cl)
|
||||
(f p)
|
||||
(fmap (fmap ( f)) cr)
|
||||
|
||||
--deriveJSON defaultOptions ''DoubleTree
|
||||
--deriveJSON defaultOptions ''LabelDoubleTree
|
||||
|
||||
Reference in New Issue
Block a user