[ ghc-Bugs-1162762 ] fromInteger-related pattern match overlap warnings

SourceForge.net noreply at sourceforge.net
Wed Jul 6 06:02:52 EDT 2005


Bugs item #1162762, was opened at 2005-03-14 04:19
Message generated for change (Settings changed) made by simonpj
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


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

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