Re: [GHC] #6028: warning for cyclic unimplemented defaults
#6028: warning for cyclic unimplemented defaults ---+ Reporter: lerkok| Owner: Type: feature request | Status: closed Priority: normal| Milestone: Component: Compiler |Version: 7.4.1 Resolution: wontfix | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Difficulty: Unknown Testcase:| Blockedby: Blocking:|Related: ---+ Comment(by lerkok): It is indeed possible to create scenarios where the cycle check would be fooled, like the one you showed above. But I don't think that's the common case. I believe it remains a fact that a simply cycle check will catch a large number of practical instances of this problem. This is similar to the pattern-match completeness warning: While it may not be accurate 100%, it's so darn useful. And it's likely to be right more often than you'd think. In the 1% of cases where it's wrong, it's just a warning that the user can explicitly turn off via `--noWarnUnimplementedCyclicMethod` or some such. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/6028#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #6028: warning for cyclic unimplemented defaults
#6028: warning for cyclic unimplemented defaults ---+ Reporter: lerkok| Owner: Type: feature request | Status: closed Priority: normal| Milestone: Component: Compiler |Version: 7.4.1 Resolution: wontfix | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Difficulty: Unknown Testcase:| Blockedby: Blocking:|Related: ---+ Changes (by igloo): * status: new = closed * difficulty: = Unknown * resolution: = wontfix Comment: It's not quite that simple. The default implementations are: {{{ negate x= 0 - x x - y = x + negate y }}} so actually (-) is defined in terms of (+), not negate. For example, if we have: {{{ data X = C deriving Show instance Num X where _ + _ = C }}} then -3 :: X evaluates to C. It also wouldn't work for shift: {{{ x `shift` i | i0 = x `shiftR` (-i) | i0 = x `shiftL` i | otherwise = x x `shiftL` i = x `shift` i x `shiftR` i = x `shift` (-i) }}} I'm not convinced that there are many instances where this would actually help, so I'm closing the ticket. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/6028#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #6028: warning for cyclic unimplemented defaults
#6028: warning for cyclic unimplemented defaults --+- Reporter: lerkok| Owner: Type: feature request | Status: new Priority: normal| Component: Compiler Version: 7.4.1 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Testcase: Blockedby:| Blocking: Related:| --+- Comment(by lerkok): Recent relevant discussion in stack overflow: http://stackoverflow.com/questions/12270239/can-ghc-warn-if-class- instance-is-a-loop -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/6028#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #6028: warning for cyclic unimplemented defaults
#6028: warning for cyclic unimplemented defaults --+- Reporter: lerkok| Owner: Type: feature request | Status: new Priority: normal| Component: Compiler Version: 7.4.1 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Testcase: Blockedby:| Blocking: Related:| --+- Comment(by lerkok): Along similar lines; it'd be really awesome if ghc computed that information, and printed it with :i, something like: ghci :i Num minimal complete definition: +, *, abs, signum, fromInteger, and one of negate, - -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/6028#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs