[GHC] #7869: GHC complains about applying a function to one argument

GHC cvs-ghc at haskell.org
Sat Apr 27 03:33:20 CEST 2013


#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



More information about the ghc-tickets mailing list