[ ghc-Bugs-1162762 ] fromInteger-related pattern match overlap
warnings
SourceForge.net
noreply at sourceforge.net
Tue Nov 29 23:15:55 EST 2005
Bugs item #1162762, was opened at 2005-03-13 20:19
Message generated for change (Comment added) made by nobody
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=108032&aid=1162762&group_id=8032
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Compiler
Group: 6.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Ashley Yakeley (ashley-y)
Assigned to: Simon Peyton Jones (simonpj)
Summary: fromInteger-related pattern match overlap warnings
Initial Comment:
The compiler incorrectly gives "Warning: Pattern match(es) are
overlapped" for this file:
{-# OPTIONS -Werror #-}
module Buggy where
instance (Num a) => Num (Maybe a) where
(Just a) + (Just b) = Just (a + b)
_ + _ = Nothing
(Just a) - (Just b) = Just (a - b)
_ - _ = Nothing
(Just a) * (Just b) = Just (a * b)
_ * _ = Nothing
negate (Just a) = Just (negate a)
negate _ = Nothing
abs (Just a) = Just (abs a)
abs _ = Nothing
signum (Just a) = Just (signum a)
signum _ = Nothing
fromInteger = Just . fromInteger
f :: Maybe Int -> Int
f 1 = 1
f Nothing = 2
f _ = 3
----------------------------------------------------------------------
Comment By: Nobody/Anonymous (nobody)
Date: 2005-11-29 20:15
Message:
Logged In: NO
If we define the first line as:
f (Just 1) = 1
there is no problem.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=108032&aid=1162762&group_id=8032
More information about the Glasgow-haskell-bugs
mailing list