[GHC] #12093: Wrong argument count in error message with TypeApplications

#12093: Wrong argument count in error message with TypeApplications -------------------------------------+------------------------------------- Reporter: kwf | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 (Type checker) | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Incorrect Unknown/Multiple | warning at compile-time Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- When I write: {{{#!hs {-# language TypeApplications #-} module Bug where wrong = id @Bool True False }}} I get the error: {{{ • Couldn't match expected type ‘Bool -> t’ with actual type ‘Bool’ • The function ‘id’ is applied to three arguments, but its type ‘Bool -> Bool’ has only one In the expression: id @Bool True False In an equation for ‘bad’: bad = id @Bool True False • Relevant bindings include bad :: t (bound at Bug.hs:8:1) }}} This seems to tell me that I ought to get rid of //two// of the arguments given to `id`, when in fact I only ought to remove //one//. In particular, the issue seems to be that GHC includes visibly applied type parameters in the count of "how many arguments is it applied to?" but does not include them in the count of "how many arguments does it have?" Suggested fix: in cases of this error with visible type application, report something akin to, "The function ‘id’ is applied to two type arguments and two value arguments, but its type has only one value argument." -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12093 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12093: Wrong argument count in error message with TypeApplications -------------------------------------+------------------------------------- Reporter: kwf | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 8.0.1 checker) | Keywords: Resolution: | TypeApplications Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by goldfire): * keywords: => TypeApplications -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12093#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12093: Wrong argument count in error message with TypeApplications -------------------------------------+------------------------------------- Reporter: kwf | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler (Type | Version: 8.0.1 checker) | Keywords: Resolution: duplicate | TypeApplications Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect | Unknown/Multiple warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: #13902 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => closed * resolution: => duplicate * related: => #13902 Comment: This was fixed in #13902. The error message now reads: {{{ Bug.hs:5:9: error: • Couldn't match expected type ‘Bool -> t’ with actual type ‘Bool’ • The expression ‘id @Bool’ is applied to two arguments, but its type ‘Bool -> Bool’ has only one In the expression: id @Bool True False In an equation for ‘wrong’: wrong = id @Bool True False • Relevant bindings include wrong :: t (bound at Bug.hs:5:1) | 5 | wrong = id @Bool True False | ^^^^^^^^^^^^^^^^^^^ }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12093#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC