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

SourceForge.net noreply at sourceforge.net
Sun Mar 13 23:19:50 EST 2005


Bugs item #1162762, was opened at 2005-03-13 20:19
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=108032&aid=1162762&group_id=8032

Category: Compiler
Group: 6.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Ashley Yakeley (ashley-y)
Assigned to: Nobody/Anonymous (nobody)
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