diff options
author | simonpj <unknown> | 1999-01-27 14:52:25 +0000 |
---|---|---|
committer | simonpj <unknown> | 1999-01-27 14:52:25 +0000 |
commit | 18976e614fd90a8d81ced2c3e9cd8e38d72a1f40 (patch) | |
tree | ba006e4eab248358b818f771064df1a37e43cc16 /ghc/compiler/deSugar/Match.lhs | |
parent | f3bed25cb37981ef391f750cae58280e71cd80bc (diff) | |
download | haskell-18976e614fd90a8d81ced2c3e9cd8e38d72a1f40.tar.gz |
[project @ 1999-01-27 14:51:14 by simonpj]
Finally! This commits the ongoing saga of Simon's hygiene sweep
FUNCTIONALITY
~~~~~~~~~~~~~
a) The 'unused variable' warnings from the renamer work.
b) Better error messages here and there, esp type checker
c) Fixities for Haskell 98 (maybe I'd done that before)
d) Lazy reporting of name clashes for Haskell 98 (ditto)
HYGIENE
~~~~~~~
a) type OccName has its own module. OccNames are represented
by a single FastString, not three as in the last round. This
string is held in Z-encoded form; a decoding function decodes
for printing in user error messages. There's a nice tight
encoding for (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,)
b) type Module is a proper ADT, in module OccName
c) type RdrName is a proper ADT, in its own module
d) type Name has a new, somwhat tidier, representation
e) much grunting in the renamer to get Provenances right.
This makes error messages look better (no spurious qualifiers)
Diffstat (limited to 'ghc/compiler/deSugar/Match.lhs')
-rw-r--r-- | ghc/compiler/deSugar/Match.lhs | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/ghc/compiler/deSugar/Match.lhs b/ghc/compiler/deSugar/Match.lhs index b0f58d1332..d9de19c434 100644 --- a/ghc/compiler/deSugar/Match.lhs +++ b/ghc/compiler/deSugar/Match.lhs @@ -95,34 +95,32 @@ dsShadowWarn ctx@(DsMatchContext kind _ _) qs = dsWarn warn where warn | length qs > maximum_output = pp_context ctx (ptext SLIT("are overlapped")) - 8 (\ f -> vcat (map (ppr_eqn f kind) (take maximum_output qs)) $$ + (\ f -> vcat (map (ppr_eqn f kind) (take maximum_output qs)) $$ ptext SLIT("...")) | otherwise = pp_context ctx (ptext SLIT("are overlapped")) - 8 (\ f -> vcat $ map (ppr_eqn f kind) qs) + (\ f -> vcat $ map (ppr_eqn f kind) qs) dsIncompleteWarn :: DsMatchContext -> [ExhaustivePat] -> DsM () dsIncompleteWarn ctx@(DsMatchContext kind _ _) pats = dsWarn warn where - warn | length pats > maximum_output - = pp_context ctx (ptext SLIT("are non-exhaustive")) - 8 (\ f -> hang (ptext SLIT("Patterns not recognized:")) - 4 (vcat (map (ppr_incomplete_pats kind) - (take maximum_output pats)) - $$ ptext SLIT("..."))) - | otherwise - = pp_context ctx (ptext SLIT("are non-exhaustive")) - 8 (\ f -> hang (ptext SLIT("Patterns not recognized:")) - 4 (vcat $ map (ppr_incomplete_pats kind) pats)) + warn = pp_context ctx (ptext SLIT("are non-exhaustive")) + (\f -> hang (ptext SLIT("Patterns not matched:")) + 4 ((vcat $ map (ppr_incomplete_pats kind) + (take maximum_output pats)) + $$ dots)) + + dots | length pats > maximum_output = ptext SLIT("...") + | otherwise = empty -pp_context NoMatchContext msg ind rest_of_msg_fun - = dontAddErrLoc "" (ptext SLIT("Some match(es)") <+> hang msg ind (rest_of_msg_fun id)) +pp_context NoMatchContext msg rest_of_msg_fun + = dontAddErrLoc "" (ptext SLIT("Some match(es)") <+> hang msg 8 (rest_of_msg_fun id)) -pp_context (DsMatchContext kind pats loc) msg ind rest_of_msg_fun +pp_context (DsMatchContext kind pats loc) msg rest_of_msg_fun = case pp_match kind pats of (ppr_match, pref) -> - addErrLocHdrLine loc message (nest ind (rest_of_msg_fun pref)) + addErrLocHdrLine loc message (nest 8 (rest_of_msg_fun pref)) where message = ptext SLIT("Pattern match(es)") <+> msg <+> ppr_match <> char ':' where |