Fix listVersion wrt #183

This commit is contained in:
Julian Ospald 2021-07-20 11:54:14 +02:00
parent 7a2570019a
commit a6108f8319
Signed by: hasufell
GPG Key ID: 3786C5262ECB4A3F

View File

@ -1010,10 +1010,10 @@ listVersions lt' criteria = do
slr <- strayCabals avTools cSet cabals slr <- strayCabals avTools cSet cabals
pure (sort (slr ++ lr)) pure (sort (slr ++ lr))
HLS -> do HLS -> do
slr <- strayHLS avTools slr <- strayHLS avTools hlsSet' hlses
pure (sort (slr ++ lr)) pure (sort (slr ++ lr))
Stack -> do Stack -> do
slr <- strayStacks avTools slr <- strayStacks avTools sSet stacks
pure (sort (slr ++ lr)) pure (sort (slr ++ lr))
GHCup -> pure lr GHCup -> pure lr
Nothing -> do Nothing -> do
@ -1113,15 +1113,16 @@ listVersions lt' criteria = do
, MonadLogger m , MonadLogger m
, MonadIO m) , MonadIO m)
=> Map.Map Version [Tag] => Map.Map Version [Tag]
-> Maybe Version
-> [Either FilePath Version]
-> m [ListResult] -> m [ListResult]
strayHLS avTools = do strayHLS avTools hlsSet' hlss = do
hlss <- getInstalledHLSs
fmap catMaybes $ forM hlss $ \case fmap catMaybes $ forM hlss $ \case
Right ver -> Right ver ->
case Map.lookup ver avTools of case Map.lookup ver avTools of
Just _ -> pure Nothing Just _ -> pure Nothing
Nothing -> do Nothing -> do
lSet <- fmap (== Just ver) hlsSet let lSet = hlsSet' == Just ver
pure $ Just $ ListResult pure $ Just $ ListResult
{ lTool = HLS { lTool = HLS
, lVer = ver , lVer = ver
@ -1147,15 +1148,16 @@ listVersions lt' criteria = do
, MonadIO m , MonadIO m
) )
=> Map.Map Version [Tag] => Map.Map Version [Tag]
-> Maybe Version
-> [Either FilePath Version]
-> m [ListResult] -> m [ListResult]
strayStacks avTools = do strayStacks avTools stackSet' stacks = do
stacks <- getInstalledStacks
fmap catMaybes $ forM stacks $ \case fmap catMaybes $ forM stacks $ \case
Right ver -> Right ver ->
case Map.lookup ver avTools of case Map.lookup ver avTools of
Just _ -> pure Nothing Just _ -> pure Nothing
Nothing -> do Nothing -> do
lSet <- fmap (== Just ver) hlsSet let lSet = stackSet' == Just ver
pure $ Just $ ListResult pure $ Just $ ListResult
{ lTool = Stack { lTool = Stack
, lVer = ver , lVer = ver