title: Haskell why does this type check
body: <pre><code>import Data.Monoid
  
  newtype Constant a b =
      Constant { getConstant :: a }
      deriving (Eq, Ord, Show)
  
  instance Functor (Constant a) where
      fmap _ (Constant a) = Constant a
  
  instance (Monoid a) =&gt; Applicative (Constant a) where
      pure x = Constant (mempty x )
      _ &lt;*&gt; (Constant a) = Constant a
  
  --:t (&lt;*&gt;)
  --(&lt;*&gt;) :: Applicative f =&gt; f (a -&gt; b) -&gt; f a -&gt; f b
  
  --:t Constant (Sum 1)
  --Constant (Sum 1) :: Num a =&gt; Constant (Sum a) b
  
  --Constant (Sum 1) &lt;*&gt; Constant (Sum 2)
  --Constant { getConstant = Sum { getSum = 2 }}
  </code></pre>
  
  <p>My question is why does the last statement type check?</p>
  
  <p>I expected the left side of &lt;*> to be of type f ( a -> b)<br />
  Where <br />
    f = Constant <br />
    (a -> b) = Sum 1?<br /></p>
  
  <p>There's nothing I can apply to (Sum 1) because it is fully applied, yet this statement compiles.</p>