Remove (by commenting out) module item-type system

This commit is contained in:
2024-09-30 11:42:10 +01:00
parent 4545caa7e6
commit 0701c4043e
37 changed files with 877 additions and 696 deletions
+29 -26
View File
@@ -61,34 +61,37 @@ combineListInfo w = filter f . map (cmm inv) $ combineItemListYouX w
f (is, (_, itm)) = _itType itm `notElem` fmap _itType (IM.restrictKeys inv (IS.fromList is))
cmm :: IM.IntMap Item -> ([Int], Item) -> ([Int], ([String], Item))
cmm inv (is, itm) = (is, itm & itType . iyModules %%~ flip combineModuleMaps mms)
where
mms = map (_iyModules . _itType . (inv IM.!)) is
cmm inv (is, itm) = (is, ([], itm))
combineModuleMaps ::
M.Map ModuleSlot ItemModuleType ->
[M.Map ModuleSlot ItemModuleType] ->
([String], M.Map ModuleSlot ItemModuleType)
combineModuleMaps = foldM combineTwoModuleMaps
--cmm :: IM.IntMap Item -> ([Int], Item) -> ([Int], ([String], Item))
--cmm inv (is, itm) = (is, itm & itType . iyModules %%~ flip combineModuleMaps mms)
-- where
-- mms = map (_iyModules . _itType . (inv IM.!)) is
combineTwoModuleMaps ::
M.Map ModuleSlot ItemModuleType ->
M.Map ModuleSlot ItemModuleType ->
([String], M.Map ModuleSlot ItemModuleType)
combineTwoModuleMaps =
mergeA
preserveMissing
(filterAMissing f)
(zipWithAMatched g)
where
f _ EMPTYMODULE = ([], False)
f _ md = ([rm "REMOVES" md], False)
g _ EMPTYMODULE md = ([], md)
g _ md EMPTYMODULE = ([], md)
g _ md2 md1 = ([rm "REPLACES" md1 ++ rm " WITH" md2], md2)
rm str md = str ++ " " ++ fullModuleName md
--combineModuleMaps ::
-- M.Map ModuleSlot ItemModuleType ->
-- [M.Map ModuleSlot ItemModuleType] ->
-- ([String], M.Map ModuleSlot ItemModuleType)
--combineModuleMaps = foldM combineTwoModuleMaps
--combineTwoModuleMaps ::
-- M.Map ModuleSlot ItemModuleType ->
-- M.Map ModuleSlot ItemModuleType ->
-- ([String], M.Map ModuleSlot ItemModuleType)
--combineTwoModuleMaps =
-- mergeA
-- preserveMissing
-- (filterAMissing f)
-- (zipWithAMatched g)
-- where
-- f _ EMPTYMODULE = ([], False)
-- f _ md = ([rm "REMOVES" md], False)
-- g _ EMPTYMODULE md = ([], md)
-- g _ md EMPTYMODULE = ([], md)
-- g _ md2 md1 = ([rm "REPLACES" md1 ++ rm " WITH" md2], md2)
-- rm str md = str ++ " " ++ fullModuleName md
-- g above could be a monoid of some description...
fullModuleName :: ItemModuleType -> String
fullModuleName = fromMaybe "EMPTYMODULE" . moduleName
--fullModuleName :: ItemModuleType -> String
--fullModuleName = fromMaybe "EMPTYMODULE" . moduleName