[Haskell-cafe] Re: Handles with their IOMode in their type
Jason Dagit
dagit at codersbase.com
Thu Dec 10 02:51:06 EST 2009
On Wed, Dec 9, 2009 at 6:00 PM, Brandon S. Allbery KF8NH <
allbery at ece.cmu.edu> wrote:
> On Dec 9, 2009, at 16:51 , Bas van Dijk wrote:
>
>> I will change the types to:
>>
>> stdin :: Handle ReadMode
>> stdout :: Handle WriteMode
>> stderr :: Handle WriteMode
>>
>> Or are there scenarios where people want to write to stdin or read
>> from stdout or stderr?
>>
>
>
> These situations *do* come up; the controlling terminal for a program is
> open read/write on all 3 file descriptors initially, ands programs like
> more/less/pg rely on this and do their I/O on stdout. Additionally, on *BSD
> pipes are actually socketpairs and therefore bidirectional, and a small
> number of programs rely on this.
>
I was surprised to hear this, so I did some fact checking:
http://books.google.com/books?id=rHyMRyDEG3gC&pg=PA39&lpg=PA39&dq=posix+write+to+stdin&source=bl&ots=vHsgioIR8J&sig=PPXTzuwuuxyx_peCnuSNVmE220I&hl=en&ei=o6cgS-DxJ5S0sgPSl82kBQ&sa=X&oi=book_result&ct=result&resnum=3&ved=0CA8Q6AEwAjgK#v=onepage&q=&f=false
Looks like you're telling the truth. Learn something new every time I read
Haskell-Cafe :)
Jason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20091210/7511dd01/attachment.html
More information about the Haskell-Cafe
mailing list