Ticket #322 (new bug: None)
fromInteger-related pattern match overlap warnings
| Reported by: | ashley-y | Owned by: | simonpj |
|---|---|---|---|
| Priority: | normal | Milestone: | _|_ |
| Component: | Compiler | Version: | 6.4 |
| Keywords: | warnings | Cc: | |
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | None/Unknown | Difficulty: | Unknown |
| Test Case: | ds060 | Blocked By: | |
| Blocking: | Related Tickets: |
Description (last modified by igloo) (diff)
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
Change History
Note: See
TracTickets for help on using
tickets.
