[GHC] #9901: Error message: f is applied to two arguments, but its type has only two (sic)

GHC ghc-devs at haskell.org
Thu Dec 18 12:52:02 UTC 2014


#9901: Error message: f is applied to two arguments, but its type has only two
(sic)
-------------------------------------+-------------------------------------
       Reporter:  zardoz             |                   Owner:
           Type:  bug                |                  Status:  new
       Priority:  normal             |               Milestone:
      Component:  Compiler (Type     |                 Version:  7.8.3
  checker)                           |        Operating System:
       Keywords:                     |  Unknown/Multiple
   Architecture:  Unknown/Multiple   |         Type of failure:
     Difficulty:  Unknown            |  None/Unknown
     Blocked By:                     |               Test Case:
Related Tickets:                     |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------
 I occasionally get type errors where the error message refers to a
 function’s
 arity in a contradictory way:

 > The function ‘X’ is applied to two arguments, […] but its type has only
 two.

 Here’s a full error message of this kind:

 lenstest.hs:89:12:
     Couldn't match type ‘Either String Int’ with ‘Maybe b0’
     Expected type: [Char] -> Either String Int
       Actual type: [Char] -> Maybe b0
     The function ‘preview’ is applied to two arguments,
     but its type ‘Getting (Data.Monoid.First b0) (Either b0 c0) b0
                   -> [Char] -> Maybe b0’
     has only two
     In the second argument of ‘($)’, namely
       ‘(preview _Left "abc" :: Either String Int)’
     In a stmt of a 'do' block:
       print $ (preview _Left "abc" :: Either String Int)
 Failed, modules loaded: none.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9901>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list