From 30aa3aaaa14ee33d668c02185123ca45d4ba5b5a Mon Sep 17 00:00:00 2001 From: justin Date: Tue, 8 Oct 2024 10:22:14 +0100 Subject: [PATCH] Use fromDistinctAscList rather than fromAscList --- ghcidOutput | 2 +- src/Dodge/DisplayInventory.hs | 4 ++-- src/Dodge/Item/Grammar.hs | 4 ++-- src/Dodge/Layout.hs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ghcidOutput b/ghcidOutput index 2667beae9..98e3a30b4 100644 --- a/ghcidOutput +++ b/ghcidOutput @@ -1 +1 @@ -All good (597 modules, at 10:13:32) +All good (597 modules, at 10:20:30) diff --git a/src/Dodge/DisplayInventory.hs b/src/Dodge/DisplayInventory.hs index 49ca82c4a..2d868840a 100644 --- a/src/Dodge/DisplayInventory.hs +++ b/src/Dodge/DisplayInventory.hs @@ -48,7 +48,7 @@ updateCombineSections w cfig sss = where mselpos = sss ^. sssExtra . sssSelPos availablelines = getAvailableListLines secondColumnParams cfig - allcombs = IM.fromAscList $ zip [0 ..] $ combineList w + allcombs = IM.fromDistinctAscList $ zip [0 ..] $ combineList w filtcombs = fromMaybe allcombs $ do str <- mstr invitms <- w ^? hud . hudElement . diSections . sssSections . ix 0 . ssItems @@ -239,7 +239,7 @@ enterCombineInv :: Configuration -> World -> World enterCombineInv cfig w = w & hud . hudElement . subInventory .~ CombineInventory sss where - cm' = IM.fromAscList $ zip [0 ..] $ combineList w + cm' = IM.fromDistinctAscList . zip [0 ..] $ combineList w cm | null cm' = IM.singleton 0 $ SelectionInfo ["No possible combinations"] 1 False white 0 | otherwise = cm' diff --git a/src/Dodge/Item/Grammar.hs b/src/Dodge/Item/Grammar.hs index 38c43bafa..bf121df97 100644 --- a/src/Dodge/Item/Grammar.hs +++ b/src/Dodge/Item/Grammar.hs @@ -182,7 +182,7 @@ invAdj im = do invIndentIM :: IM.IntMap Item -> IM.IntMap (Item, Int, LabelDoubleTreeNodeType ComposeLinkType) invIndentIM = - IM.fromAscList . zip [0 ..] . reverse . map (over _1 (^. _1)) + IM.fromDistinctAscList . zip [0 ..] . reverse . map (over _1 (^. _1)) . concatMap ldtToIndentList . map (bimap _iatType (\(x, y, _) -> (x, y))) . invLDT @@ -215,7 +215,7 @@ allInvLocs inv = foldMap (f . LocLDT TopLDT) (IM.elems (invRootTrees inv)) mempt -- returns an intmap with trees for root items, indexed by inventory position invRootTrees :: IM.IntMap Item -> IM.IntMap (LabelDoubleTree ItemLink ComposedItem) -invRootTrees = IM.fromAscList . reverse . map (getid . fmap (\(x, y, _) -> CItem x y)) . invLDT +invRootTrees = IM.fromDistinctAscList . reverse . map (getid . fmap (\(x, y, _) -> CItem x y)) . invLDT where getid :: LabelDoubleTree ItemLink ComposedItem -> (Int,LabelDoubleTree ItemLink ComposedItem) getid t = (t ^?! ldtValue . cItem . itLocation . ilInvID, t) diff --git a/src/Dodge/Layout.hs b/src/Dodge/Layout.hs index 4d504b464..dfeaa4ad2 100644 --- a/src/Dodge/Layout.hs +++ b/src/Dodge/Layout.hs @@ -146,7 +146,7 @@ setupWorldBounds w = wallsFromRooms :: [Room] -> IM.IntMap Wall wallsFromRooms = -- divideWalls . - IM.fromAscList + IM.fromDistinctAscList . zipWith f [0 ..] . removeInverseWalls . foldl' (flip cutWalls) []