This example seems to break the type sig for $, and it works
apply, dictionary, haskell, types
Solution
The behavior you are observing is due to how partial application works for infix operators. This is often called "section application" and you are applying `2` as the "right section" which would be the second argument. So you have:
($) :: (a -> b) -> a -> b
^
|
This is the type variable for the argument '2'
And you can confirm this via:
ghci
> :t ($2)
($2) :: Num a => (a -> b) -> b
You can likely find this info hidden somewhere in most decently complete tutorials or you can see the Haskell report section on sections.
Problem
If the type for `($)` is `(a -> b) -> a -> b`, then why are you allowed to curry it as `($2)`? 2 is not of type `(a -> b)`. See below example. ``` map ($2)[(+1),(+2)] ``` This is legit, awesome and intuitively makes sense. Please tell me how it is consistent with the type system rules? Cheers