diff options
author | Wojciech Baranowski <wbaranowski@protonmail.com> | 2019-04-13 12:31:13 +0300 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-04-29 21:02:38 -0400 |
commit | fb9408dd779f53e2d13dd18638814118f6ca0cac (patch) | |
tree | 2decc2e09e61d100a4f10c51f21fe395cc3d901c /compiler/rename/RnEnv.hs | |
parent | 2c115085982ba19985f2e00ca938370647e38e4b (diff) | |
download | haskell-fb9408dd779f53e2d13dd18638814118f6ca0cac.tar.gz |
Print suggestions in a single message
Diffstat (limited to 'compiler/rename/RnEnv.hs')
-rw-r--r-- | compiler/rename/RnEnv.hs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/compiler/rename/RnEnv.hs b/compiler/rename/RnEnv.hs index 381ba2bfa6..7f12e05816 100644 --- a/compiler/rename/RnEnv.hs +++ b/compiler/rename/RnEnv.hs @@ -1499,11 +1499,13 @@ lookupBindGroupOcc ctxt what rdr_name candidates names_in_scope = case similar_names of - [] -> Outputable.empty - _ -> vcat $ map (\x -> text "Perhaps you meant" <+> - quotes (ppr x) <+> - parens (pprDefinedAt x)) - similar_names + [] -> Outputable.empty + [n] -> text "Perhaps you meant" <+> + quotes (ppr n) <+> + parens (pprDefinedAt n) + _ -> text "Perhaps you meant one of these:" <+> + pprWithCommas (\x -> quotes (ppr x) <+> parens (pprDefinedAt x)) + similar_names where similar_names = fuzzyLookup (unpackFS $ occNameFS $ rdrNameOcc rdr_name) |