title: Safer Handles in Haskell?
body: <p>I felt a bit insecure when using Haskell Handles. Namely, I'm looking for two features (maybe they are already there and in that case please forgive my ignorance).</p>
  
  <ol>
  <li>When I've obtained a handle (e.g., returned by <code>Network.accept</code>), which
  is both readable and writable, I wish to convert them into a pair of
  <strong>read-only</strong> and <strong>write-only</strong> handles such that writing to a read-only
  handle won't type check and vice versa. (Perhaps one can achieve
  this using phantom types and wraps around IO functions?)</li>
  <li>In a concurrent setting, I found that it is possible for <strong>multiple threads</strong> to write to the same handle, which gives rise to quite nasty consequences. How could one prevent that through the type system (if possible) or at least get notified of such case via thrown exception during run-time?</li>
  </ol>
  
  <p>Any idea is welcome.</p>