title: Applicative laws for alternative class formulations
body: <p>A well-known alternative formulation of <code>Applicative</code> (see, e.g., Typeclassopedia) is</p>
  
  <pre><code>class Functor f =&gt; Monoidal f where
    unit :: f ()
    pair :: f a -&gt; f b -&gt; f (a, b)
  </code></pre>
  
  <p>This leads to laws that look more like typical identity and associativity laws than what you get from <code>Applicative</code>, but only when you work through pair-reassociating isomorphisms. Thinking about this a few weeks ago, I came up with two other formulations that avoid this problem.</p>
  
  <pre><code>class Functor f =&gt; Fapplicative f where
    funit :: f (a -&gt; a)
    fcomp :: f (b -&gt; c) -&gt; f (a -&gt; b) -&gt; f (a -&gt; c)
  
  class Functor f =&gt; Capplicative f where
    cunit :: Category (~&gt;) =&gt; f (a ~&gt; a)
    ccomp :: Category (~&gt;) =&gt; f (b ~&gt; c) -&gt; f (a ~&gt; b) -&gt; f (a ~&gt; c)
  </code></pre>
  
  <p>It's easy to implement <code>Capplicative</code> using <code>Applicative</code>, <code>Fapplicative</code> using <code>Capplicative</code>, and <code>Applicative</code> using <code>Fapplicative</code>, so these all have equivalent power.</p>
  
  <p>The identity and associativity laws are entirely obvious. But <code>Monoidal</code> needs a naturality law, and these must as well. How might I formulate them? Also: <code>Capplicative</code> seems to suggest an immediate generalization:</p>
  
  <pre><code>class (Category (~&gt;), Functor f) =&gt; Appish (~&gt;) f where
    unit1 :: f (a ~&gt; a)
    comp1 :: f (b ~&gt; c) -&gt; f (a ~&gt; b) -&gt; f (a ~&gt; c)
  </code></pre>
  
  <p>I am a bit curious about whether this (or something similar) is good for something.</p>