[GHC] #7869: GHC complains about applying a function to one argument
#7869: GHC complains about applying a function to one argument -----------------------------+---------------------------------------------- Reporter: Mortchek | Owner: Type: bug | Status: new Priority: normal | Component: Compiler Version: 7.4.2 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Blockedby: Blocking: | Related: -----------------------------+---------------------------------------------- When this function is compiled: {{{ let f = (\x -> f x) :: [a] -> b }}} GHC gives this error message: {{{ Foo.hs:1:12: Couldn't match type `b' with `b1' `b' is a rigid type variable bound by the inferred type of f :: [a] -> b at Foo.hs:1:1 `b1' is a rigid type variable bound by an expression type signature: [a1] -> b1 at Foo.hs:1:5 Expected type: [a1] -> b1 Actual type: [a] -> b The function `f' is applied to one argument, but its type `[a] -> b' has only one In the expression: f x In the expression: (\ x -> f x) :: [a] -> b Foo.hs:1:12: Couldn't match type `a' with `a1' `a' is a rigid type variable bound by the inferred type of f :: [a] -> b at Foo.hs:1:1 `a1' is a rigid type variable bound by an expression type signature: [a1] -> b1 at Foo.hs:1:5 Expected type: [a1] -> b1 Actual type: [a] -> b The function `f' is applied to one argument, but its type `[a] -> b' has only one In the expression: f x In the expression: (\ x -> f x) :: [a] -> b }}} The erroneous part is: {{{ The function `f' is applied to one argument, but its type `[a] -> b' has only one In the expression: f x In the expression: (\ x -> f x) :: [a] -> b }}} This error message should not be present, as applying a function to one argument is not a problem. This happens in GHCi as well. -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7869> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#7869: GHC complains about applying a function to one argument -----------------------------+---------------------------------------------- Reporter: Mortchek | Owner: Type: bug | Status: new Priority: normal | Component: Compiler Version: 7.4.2 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Blockedby: Blocking: | Related: -----------------------------+---------------------------------------------- Comment(by simonpj@…): commit b988dc39a06278acc2373ba9a40ee08da0127411 {{{ Author: Simon Peyton Jones <simonpj@microsoft.com> Date: Mon Apr 29 17:28:20 2013 +0100 Suppress a misleading error message (Trac #7869) We were saying The function `f' is applied to one argument, but its type `[a] -> b' has only one which is obviously bogus. This fix suppresses the explanation in cases where it may not be the *right* explanation. compiler/typecheck/TcUnify.lhs | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) }}} -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7869#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#7869: GHC complains about applying a function to one argument ------------------------------------------+--------------------------------- Reporter: Mortchek | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.4.2 Resolution: fixed | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Difficulty: Unknown Testcase: typecheck/should_fail/T7869 | Blockedby: Blocking: | Related: ------------------------------------------+--------------------------------- Changes (by simonpj): * status: new => closed * difficulty: => Unknown * resolution: => fixed * testcase: => typecheck/should_fail/T7869 Comment: Excellent point thank you. Simon -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7869#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC