@@ -431,19 +431,24 @@ addWeights toWeight paths =
433bests :: [(Path, Int)] -> [Path]
433bests :: [(Path, Int)] -> [Path]
434−bests ( (headPath, headWeight) : weightedPaths ) =
434+bests allPaths =
435− let
435+ case allPaths of
436− gatherMinimum acc@(minWeight, paths) (path, weight) =
436+ [] ->
437− if weight == minWeight then
437+ error "Cannot choose the best of zero paths. This should never happen."
438− (minWeight, path : paths)
439+ (headPath, headWeight) : weightedPaths ->
441+ gatherMinimum acc@(minWeight, paths) (path, weight) =
440− else if weight < minWeight then
442+ if weight == minWeight then
441− (weight, [path])
443+ (minWeight, path : paths)
445+ else if weight < minWeight then
446− snd (List.foldl' gatherMinimum (headWeight, [headPath]) weightedPaths)
451+ snd (List.foldl' gatherMinimum (headWeight, [headPath]) weightedPaths)
449-- PATH PICKING HEURISTICS
454-- PATH PICKING HEURISTICS