summaryrefslogtreecommitdiff
path: root/compiler/rename/RnEnv.hs
diff options
context:
space:
mode:
authorWojciech Baranowski <wbaranowski@protonmail.com>2019-04-13 12:31:13 +0300
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-04-29 21:02:38 -0400
commitfb9408dd779f53e2d13dd18638814118f6ca0cac (patch)
tree2decc2e09e61d100a4f10c51f21fe395cc3d901c /compiler/rename/RnEnv.hs
parent2c115085982ba19985f2e00ca938370647e38e4b (diff)
downloadhaskell-fb9408dd779f53e2d13dd18638814118f6ca0cac.tar.gz
Print suggestions in a single message
Diffstat (limited to 'compiler/rename/RnEnv.hs')
-rw-r--r--compiler/rename/RnEnv.hs12
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)