[GHC] #12544: Improved warning for redundant-constraints

#12544: Improved warning for redundant-constraints -------------------------------------+------------------------------------- Reporter: crockeea | Owner: Type: feature | Status: new request | Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Currently, {{{ foo :: (Num a, Integral a) => a -> a foo = id }}} produces the warning {{{ Main.hs:1:1: warning: [-Wredundant-constraints] • Redundant constraints: (Num a, Integral a) • In the type signature for: foo :: (Num a, Integral a) => a -> a }}} Since GHC can detect there is a redundancy, it would be nice it also told me which constraint was redundant. In #9939, I suggested that the warning include something to the effect of `(Num a) is implied by (Integral a)`. Lets make this as easy for the user as possible. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12544 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12544: Improved warning for redundant-constraints -------------------------------------+------------------------------------- Reporter: crockeea | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: 9939 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by crockeea): * related: => 9939 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12544#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12544: Improved warning for redundant-constraints -------------------------------------+------------------------------------- Reporter: crockeea | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #9939 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by crockeea): * related: 9939 => #9939 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12544#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12544: Improved warning for redundant-constraints -------------------------------------+------------------------------------- Reporter: crockeea | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #9939 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by mpickering): I think this already happens. {{{ foo :: (Num a, Integral a) => a -> a foo = (1 +) }}} gives the warning {{{ testtc.hs:1:1: warning: [-Wredundant-constraints] • Redundant constraint: Num a • In the type signature for: foo :: (Num a, Integral a) => a -> a }}} Both constraints are listed in your example as neither is used in the body of the function. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12544#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12544: Improved warning for redundant-constraints -------------------------------------+------------------------------------- Reporter: crockeea | Owner: Type: feature request | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: invalid | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #9939 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by crockeea): * status: new => closed * resolution: => invalid Comment: Ah, that makes sense. Thanks mpickering! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12544#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC