logo       

[ ghc-Bugs-485324 ] Check for exhaustive patterns is broken: msg#00064

lang.haskell.glasgow.bugs

Subject: [ ghc-Bugs-485324 ] Check for exhaustive patterns is broken

Bugs item #485324, was opened at 2001-11-25 15:05
Message generated for change (Settings changed) made by simonmar
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=108032&aid=485324&group_id=8032

Category: Compiler
Group: 5.02
Status: Open
Resolution: None
>Priority: 2
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: Check for exhaustive patterns is broken

Initial Comment:
When some of the patterns in a function definition or
case expression contain guards, the compiler gives
false warnings about non-exhaustive pattern matches. A
pity, because this kind of warning is very useful
indeed!

For example, I get
>ghc --make -Wall See.hs
ghc-5.02.1: chasing modules from: See.hs
Compiling See ( See.hs, ./See.o )

See.hs:17: Warning: Pattern match(es) are
non-exhaustive
In the definition of `insert':
Patterns not matched: _ _ (TREE _ _ _ _)

See.hs:41: Warning: Pattern match(es) are
non-exhaustive
In a case alternative EMPTY: Patterns not matched:
TREE _ _ _ _

for the attached file.

[I am not sure filling in the e-mail address box had
any effect on the last two complaints I submitted, so I
repeat my address here:
feliks@xxxxxx]

----------------------------------------------------------------------

Comment By: Julian Seward (sewardj)
Date: 2002-01-03 13:57

Message:
Logged In: YES
user_id=50143


Code is:

insert k v EMPTY = Just (TREE k v EMPTY EMPTY)


insert k v (TREE k' v' left right)

| k < k' = case insert k v left of
Nothing -> Nothing
Just left' -> Just (TREE k' v'
left' right)

| k > k' = case insert k v right of
Nothing -> Nothing
Just right' -> Just (TREE k' v'
left right')

| k == k' = Nothing


----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=108032&aid=485324&group_id=8032


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise