title: Why can you create a value with "Just (+)"?
body: <p>Currently I'm learning Haskell and are stuck with the instantiation of types to typeclasses. I actually don't understand, why it's possible to create a value of the <code>Maybe a</code> type with <code>Just (+)</code>.</p>
  
  <p>The problem why this behaves strange to me is, that the Maybe type is defined as an instance of the <code>Eq</code> typeclass (see <a href="https://hackage.haskell.org/package/base-4.12.0.0/docs/src/GHC.Maybe.html#Maybe" rel="nofollow noreferrer">Haskell source</a>) and that if you derive an instance for a type, all the fields of the value / data constructors of that type  must be also an instance of the <code>Eq</code> typeclass (<a href="http://learnyouahaskell.com/making-our-own-types-and-typeclasses#derived-instances" rel="nofollow noreferrer">here</a>).</p>
  
  <p>With this knowledge in mind, the following code shouldn't be compilable or executable, because a function is not a part of the <code>Eq</code> typeclass:</p>
  
  <pre><code>let a = Just (+)
  let b = Just (-)
  </code></pre>
  
  <p>But GHCi actually executes the code without throwing an error message. If you then try to compare these two values (which shouldn't also be possible) the interpreter comes up with the follwing error message:</p>
  
  <pre><code>a == b
  
  &lt;interactive&gt;:24:1: error:
      * No instance for (Eq (Integer -&gt; Integer -&gt; Integer))
          arising from a use of `=='
          (maybe you haven't applied a function to enough arguments?)
      * In the expression: a == b
        In an equation for `it': it = a == b
  </code></pre>
  
  <p>This problem also occurs if you create your own <code>Maybe a</code> type.</p>