title: What's preferred among liftM, lilftA, etc
body: <p>Lately I've been writing FFI code that returns a data structure in the IO monad. For example:</p>
  
  <pre><code>peek p = Vec3 &lt;$&gt; (#peek aiVector3D, x) p
                &lt;*&gt; (#peek aiVector3D, y) p
                &lt;*&gt; (#peek aiVector3D, z) p
  </code></pre>
  
  <p>Now I can think of four nice ways to write that code, all closely related:</p>
  
  <pre><code>peek p = Vec3 &lt;$&gt; io1 &lt;*&gt; io2 &lt;*&gt; io3
  peek p = liftA3 Vec3 io1 io2 io3
  peek p = return Vec3 `ap` io1 `ap` io2 `ap` io3
  peek p = liftM3 Vec3 io1 io2 io3
  </code></pre>
  
  <p>Notice that I'm asking about monadic code that doesn't require anything beyond what <code>Applicative</code> provides. What is the preferred way to write this code? Should I use <code>Applicative</code> to emphasize what the code does, or should I use <code>Monad</code> because it might (?) have optimizations over <code>Applicative</code>?</p>
  
  <p>The question is slightly complicated by the fact that there are only <code>[liftA..liftA3]</code> and <code>[liftM..liftM5]</code> but I have several records with more than three or five members, so if I decide to go with <code>lift{A,M}</code> I lose some consistency because I would have to use a different method for the larger records.</p>