title: Typing in Module Printf
body: <p>In the document of <a href="http://caml.inria.fr/pub/docs/manual-ocaml/libref/Printf.html" rel="nofollow">Module Printf</a>, I don't understand the mechanism of <code>('a, out_channel, unit) format</code>, thought I use that a lot in practice.</p>
  
  <p>For instance, the following functions type well while compiling:</p>
  
  <pre><code>type t =
    { x: int;
      y: int }
  
  let print (chan: out_channel) (co: t) : unit =
    Printf.fprintf chan "(%d, %d)" x y
  
  let try (co0: t) (co1: t) =
    Printf.fprintf Pervasives.stdout "From %a To %a" print co0 print co1
  </code></pre>
  
  <p>The signature of <code>Printf.fprintf</code> is <code>: out_channel -&gt; ('a, out_channel, unit) format -&gt; 'a</code>, but I don't see what <code>('a, out_channel, unit) format</code> matches in <code>"From %a To %a" print co0 print co1</code>.</p>
  
  <p>Also, the signature of <code>print</code> is <code>out_channel -&gt; t -&gt; unit</code>, why is <code>print co0 print co1</code> acceptable in the code?</p>
  
  <p>In one word, could anyone explain how <code>Printf.fprintf Pervasives.stdout "From %a To %a" print co0 print co1</code> is typed?</p>