Skip to content

Commit

Permalink
Clear Stan suggestion; eliminate partial minimum
Browse files Browse the repository at this point in the history
  • Loading branch information
mpilgrem committed Oct 20, 2023
1 parent 4418547 commit fca839a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
6 changes: 0 additions & 6 deletions .stan.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@
scope = "all"
type = "Exclude"

# Partial: base/minimum
[[check]]
id = "STAN-0014"
scope = "all"
type = "Exclude"

# Partial: base/minimumBy
[[check]]
id = "STAN-0016"
Expand Down
9 changes: 6 additions & 3 deletions src/Stack/Types/Build/Exception.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import qualified Distribution.Text as C
import Distribution.Types.PackageName ( mkPackageName )
import Distribution.Types.TestSuiteInterface ( TestSuiteInterface )
import qualified Distribution.Version as C
import RIO.NonEmpty ( nonEmpty )
import RIO.Process ( showProcessArgDebug )
import Stack.Constants
( defaultUserConfigPath, wiredInPackages )
Expand Down Expand Up @@ -852,10 +853,12 @@ getShortestDepsPath (MonoidMap parentsMap) wanted' name =
]
findShortest _ paths | M.null paths = []
findShortest fuel paths =
case targets of
[] -> findShortest (fuel - 1) $ M.fromListWith chooseBest $
case nonEmpty targets of
Nothing -> findShortest (fuel - 1) $ M.fromListWith chooseBest $
concatMap extendPath recurses
_ -> let (DepsPath _ _ path) = L.minimum (map snd targets) in path
Just targets' ->
let (DepsPath _ _ path) = minimum (snd <$> targets')
in path
where
(targets, recurses) =
L.partition (\(n, _) -> n `Set.member` wanted') (M.toList paths)
Expand Down

0 comments on commit fca839a

Please sign in to comment.