<div dir="ltr">I think we found a way! (With a *ton* of help from @aavogt - might actually be more correct to say he found the way :) )<div><br></div><div>You can use `hDupTo` to change what a Handle points to. You can use `mkFileHandle` in GHC.IO.Internal to create a new file handle. You can implement your own IODevice and BufferedIO datatype to give to `mkFileHandle` instead of using `Fd`. Then, when your "device" is being read from, you just implement `newBuffer` and `readBuffer` to do whatever you need them to.</div>

<div><br></div><div>Results pending.</div><div><br></div><div>-- Andrew</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Jan 5, 2014 at 4:14 PM, Donn Cave <span dir="ltr"><<a href="mailto:donn@avvanta.com" target="_blank">donn@avvanta.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I bet a quarter you can't do it.  You'd need access to the process state -<br>
whether it's blocking for I/O and whether one of the units in the input set<br>
is 0 ("stdin".)  Even if you could get that? you'd have to poll for it, which<br>
would be hideous.<br>
<br>
That's the UNIX I/O model.  I've always found it a little annoying, because<br>
I could do this with the VMS `mailbox' device, analogous to UNIX pipes -<br>
in various ways a more sophisticated interprocess communication system than<br>
UNIX's.<br>
<span class="HOEnZb"><font color="#888888"><br>
        Donn<br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</div></div></blockquote></div><br></div>