diff options
| author | Shachaf Ben-Kiki <shachaf@gmail.com> | 2014-07-13 15:19:33 -0500 |
|---|---|---|
| committer | Austin Seipp <austin@well-typed.com> | 2014-07-13 15:19:33 -0500 |
| commit | 1d71e96958cb4374b383e2f254b5358386bf835c (patch) | |
| tree | 4627ad8b8c9586fab685235368c30a2d1661c521 /compiler | |
| parent | 8af2f702210b359dad1e65fb029ddf934b967edc (diff) | |
| download | haskell-1d71e96958cb4374b383e2f254b5358386bf835c.tar.gz | |
Fix ghci tab completion of duplicate identifiers.
Summary:
Currently, if the same identifier is imported via multiple modules, ghci
shows multiple completions for it. Use the nub of the completions
instead so that it only shows up once.
Signed-off-by: Shachaf Ben-Kiki <shachaf@gmail.com>
Test Plan: by hand
Reviewers: simonmar, austin, hvr
Reviewed By: austin, hvr
Subscribers: hvr, simonmar, relrod, carter
Differential Revision: https://phabricator.haskell.org/D58
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/utils/Util.lhs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/utils/Util.lhs b/compiler/utils/Util.lhs index 0274c590ea..2dcc73fd89 100644 --- a/compiler/utils/Util.lhs +++ b/compiler/utils/Util.lhs @@ -47,7 +47,7 @@ module Util ( nTimes, -- * Sorting - sortWith, minWith, + sortWith, minWith, nubSort, -- * Comparisons isEqual, eqListBy, eqMaybeBy, @@ -126,6 +126,7 @@ import Data.Ord ( comparing ) import Data.Bits import Data.Word import qualified Data.IntMap as IM +import qualified Data.Set as Set import Data.Time #if __GLASGOW_HASKELL__ < 705 @@ -490,6 +491,9 @@ sortWith get_key xs = sortBy (comparing get_key) xs minWith :: Ord b => (a -> b) -> [a] -> a minWith get_key xs = ASSERT( not (null xs) ) head (sortWith get_key xs) + +nubSort :: Ord a => [a] -> [a] +nubSort = Set.toAscList . Set.fromList \end{code} %************************************************************************ |
