title: Type of printfn in F#, static vs dynamic string
body: <p>I just began toying around with F# in Mono and the following problem arose that I cannot quite understand. Looking up information on <code>printfn</code> and <code>TextWriterFormat</code> didn't bring enlightenment either, so I thought I'm going to ask here.</p>
  
  <p>In FSI I run the following:</p>
  
  <pre><code>&gt; "hello";;
  val it : string = "hello"
  &gt; printfn "hello";;
  hello
  val it : unit = ()
  </code></pre>
  
  <p>Just a normal string and printing it. Fine. Now I wanted to declare a variable to contain that same string and print it as well:</p>
  
  <pre><code>&gt; let v = "hello" in printfn v ;;
  let v = "hello" in printfn v ;;
  ---------------------------^
  \...\stdin(22,28): error FS0001: The type 'string' is not compatible with the type 'Printf.TextWriterFormat&lt;'a&gt;'
  </code></pre>
  
  <p>I understood from my reading that <code>printfn</code> requires a constant string. I also understand that I can get around this problem with something like <code>printfn "%s" v</code>. </p>
  
  <p>However, I'd like to understand what's going on with the typing here. Clearly, <code>"hello"</code> is of type <code>string</code> as well as <code>v</code> is. Why is there a type problem then? Is <code>printfn</code> something special? As I understand it the compiler already performs type-checking on the arguments of the first string, such that <code>printfn "%s" 1</code> fails.. this could of course not work with dynamic strings, but I assumed that to be a mere convenience from the compiler-side for the static case.</p>