Custom Query
Results (28 - 30 of 5834)
| Ticket | Resolution | Summary | Owner | Reporter |
|---|---|---|---|---|
| #29 | invalid | Check for exhaustive patterns is broken | nobody | |
| description |
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@crt.se]
|
|||
| #30 | Duplicate | Check for exhaustive patterns continued | nobody | nobody |
| description |
An atttempt to attach a file to the last submission
resulted in the
following message from Netscape (?):
Fatal error: Call to a member function on a
non-object in common/tracker/ArtifactFile.class on
line 106
So I include the file below (the line numbers will be
changed),
================================
module See where
data Tree key value
= EMPTY
| TREE key value (Tree key value) (Tree
key value)
insert :: ( Ord key ) =>
key -> value -> -- insert this
new key and value
Tree key value -> -- into this
tree
Maybe (Tree key value) -- to form (Just
new tree ),
--
or Nothing if key is present
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
-- Same with a case expression:
insert' :: ( Ord key ) =>
key -> value -> Tree key value -> Maybe
(Tree key value)
insert' k v t =
case t of
EMPTY -> Just (TREE k v EMPTY EMPTY)
(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
-- Nonsensical, but patterns without guards:
insert'' ::
key -> value -> Tree key value -> Maybe (Tree key
value)
insert'' _ _ EMPTY = Nothing
insert'' k v (TREE _ _ left right) = Just (TREE k v
left right)
======================================
|
|||
| #31 | None | No -fnowarn-missing-signature | nobody | nobody |
| description |
On p. 53 the manual says (in the description of "-Wall"): To turn off any warning, simply give the corresponding -fno-warn-... option on the command line. One of the options is -fwarn-missing-signatures (p. 54). Yet the compiler produces an error message: > ghc --make -odir ../ghc -hidir ../ghc testDeclarationsMain.hs -o testDeclarations -Wall -fnowarn-missing-signatures ghc-5.02.1: unrecognised flag: -fnowarn-missing-signatures |
|||
Note: See TracQuery
for help on using queries.
