[GHC] #10224: Partial type signatures generate typed hole warnings
#10224: Partial type signatures generate typed hole warnings -------------------------------------+------------------------------------- Reporter: quchen | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.10.2 Component: Compiler | Version: 7.10.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Incorrect Unknown/Multiple | warning at compile-time Test Case: | Blocked By: Blocking: | Related Tickets: Differential Revisions: | -------------------------------------+------------------------------------- GHCi generates typed hole warnings in type signatures even when PartialTypeSignatures is enabled: {{{
:set -XPartialTypeSignatures
:t (==) :: Char -> _ <interactive>:1:17: Warning: Found hole ‘_’ with type: Char -> Bool In an expression type signature: Char -> _ In the expression: (==) :: Char -> _ (==) :: Char -> _ :: Char -> Char -> Bool
:set -XNoPartialTypeSignatures
:t (==) :: Char -> _ <interactive>:1:17: Found hole ‘_’ with type: Char -> Bool To use the inferred type, enable PartialTypeSignatures In an expression type signature: Char -> _ In the expression: (==) :: Char -> _ }}}
Similarly, GHC 7.10.1, when given the following source, {{{ {-# LANGUAGE PartialTypeSignatures #-} f = (==) :: Char -> _ main = return () }}} mentions that it "found a hole". -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10224> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10224: Partial type signatures generate typed hole warnings -------------------------------------+------------------------------------- Reporter: quchen | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.10.2 Component: Compiler | Version: 7.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by mpickering): I think this is the expected behaviour. From the user guide:
By default, the type-checker will report an error message for each hole in a partial type signature, informing the programmer of the inferred type. When the -XPartialTypeSignatures flag is enabled, the type-checker will accept the inferred type for each hole, generating warnings instead of errors. Additionally, these warnings can be silenced with the -fno- warn-partial-type-signatures flag.
-- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10224#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10224: Partial type signatures generate typed hole warnings -------------------------------------+------------------------------------- Reporter: quchen | Owner: Type: bug | Status: closed Priority: normal | Milestone: 7.10.2 Component: Compiler | Version: 7.10.1 Resolution: invalid | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by simonpj): * status: new => closed * resolution: => invalid Comment: I think mpickering is right. Seem ok? I'll close as invalid, but reopen if you think this is wrong. Simon -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10224#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10224: Partial type signatures generate typed hole warnings -------------------------------------+------------------------------------- Reporter: quchen | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.10.2 Component: Compiler | Version: 7.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by goldfire): * status: closed => new * resolution: invalid => Comment: I find the warning message quite misleading. Here is my (uninteresting) case: {{{ foo :: _ -> Bool foo True = False foo False = True }}} I get this warning (with `-XPartialTypeSignatures`) {{{ Scratch.hs:18:8: warning: Found hole: _ :: Bool In the type signature for ‘foo’: _ -> Bool }}} I think of "hole" as something in an expression instead of a type. In a type, I thought it was called a "wildcard". In any case, `_ :: Bool` is wrong. My `_` certainly does not have type `Bool`. It has '''value''' `Bool`. Here is my suggested output: {{{ Scratch.hs:18:8: warning: Found type wildcard: `_' standing in for `Bool' In the type signature for ‘foo’: _ -> Bool }}} I'm reopening on the basis that, even if my hole vs. wildcard distinction is silly nitpicking, saying `_ :: Bool` is wrong and should be fixed. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10224#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10224: Partial type signatures generate typed hole warnings -------------------------------------+------------------------------------- Reporter: quchen | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.10.2 Component: Compiler | Version: 7.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by Simon Peyton Jones <simonpj@…>): In [changeset:"9e86bf1b346934e04ccc17ec50ea7e7d906f25e2/ghc"]: {{{ #!CommitTicketReference repository="ghc" revision="9e86bf1b346934e04ccc17ec50ea7e7d906f25e2" Better type wildcard errors Adopts sugggestion in Trac #10224, comment:3 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10224#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10224: Partial type signatures generate typed hole warnings -------------------------------------+------------------------------------- Reporter: quchen | Owner: Type: bug | Status: closed Priority: normal | Milestone: 7.10.2 Component: Compiler | Version: 7.10.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by simonpj): * status: new => closed * resolution: => fixed Comment: Good idea -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10224#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10224: Partial type signatures generate typed hole warnings -------------------------------------+------------------------------------- Reporter: quchen | Owner: Type: bug | Status: closed Priority: normal | Milestone: 7.10.2 Component: Compiler | Version: 7.10.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by Simon Peyton Jones <simonpj@…>): In [changeset:"d7335f74744a78bb468326b13fdd8b0c471eb71f/ghc"]: {{{ #!CommitTicketReference repository="ghc" revision="d7335f74744a78bb468326b13fdd8b0c471eb71f" Test Trac #10463 was fixed along with Trac #10224 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10224#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10224: Partial type signatures generate typed hole warnings -------------------------------------+------------------------------------- Reporter: quchen | Owner: Type: bug | Status: closed Priority: normal | Milestone: 7.10.2 Component: Compiler | Version: 7.10.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by Thomas Miedema <thomasmiedema@…>): In [changeset:"f607393b7ffa8a06417e3f1263d2610d6bfe8279/ghc"]: {{{ #!CommitTicketReference repository="ghc" revision="f607393b7ffa8a06417e3f1263d2610d6bfe8279" Testsuite: accept new stderr for T9497{a,b,c}-run (#10224) }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10224#comment:7> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC