title: Using open unions outside the module they were defined in
body: <p>Why does this work fine?</p>
  
  <pre><code>module Account = struct
  
   type account_type = Current of float | Savings of float
  
  end
  
  let sarah = Account.Current 100.0;;
  </code></pre>
  
  <p>While the final line in the following produces an <code>Error: syntax error</code>?</p>
  
  <pre><code>module Account = struct
  
    type 'a account_type = [&gt; `Current of float | `Savings of float ] as 'a
  
  end
  
  let pete = Account.`Current 100.0;;
  </code></pre>
  
  <p>That is, why can't I use the open union type outside the module without opening the module? I should say I've found out that changing the final line to:  </p>
  
  <pre><code>open Account;;
  let pete = `Current 100.0;;
  </code></pre>
  
  <p>works fine, but obviously this is cumbersome if I use <code>account_type</code> a lot, or alternatively I have to open <code>Account</code> at the start of any code section where <code>account_type</code> is used, which means I'd sacrifice the abstraction I'd get by using a signature for <code>Account</code><br>
  I've trawled through several OCaml tutorials as well as the INRIA documentation, and I can't find any mention of how you do this.<br>
  Is it possible to avoid having to open the module every time I want to use an <code>account_type</code>?</p>
  
  <p>Thanks in advance,</p>
  
  <p>Zach</p>