|
Re: [GHC] #322: fromInteger-related pattern match overlap warnings: msg#00166lang.haskell.glasgow.bugs
#322: fromInteger-related pattern match overlap warnings ----------------------+----------------------------------------------------- Reporter: ashley-y | Owner: simonpj Type: bug | Status: assigned Priority: normal | Milestone: _|_ Component: Compiler | Version: 6.4 Severity: normal | Resolution: None Keywords: warnings | Difficulty: Unknown Testcase: ds060 | Architecture: Unknown Os: Unknown | ----------------------+----------------------------------------------------- Changes (by igloo): * architecture: => Unknown * difficulty: => Unknown * milestone: => _|_ * keywords: => warnings * testcase: => ds060 * os: => Unknown Old description: > {{{ > 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 > > }}} New description: {{{ 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 }}} -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/322> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler_______________________________________________ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@xxxxxxxxxxx http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: [GHC] #317: Simplifier doesn't preserve bottoms sometimes, GHC |
|---|---|
| Next by Date: | Re: [GHC] #344: double-panic with GADTs, GHC |
| Previous by Thread: | Re: [GHC] #317: Simplifier doesn't preserve bottoms sometimes, GHC |
| Next by Thread: | Re: [GHC] #344: double-panic with GADTs, GHC |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |