[Haskell-cafe] Execution of external command

Jonathan Cast jonathanccast at fastmail.fm
Sun Dec 16 03:24:14 EST 2007

On 14 Dec 2007, at 1:21 AM, Jules Bean wrote:

> Evan Laforge wrote:
>>> it seems that script may be not terminated if its output isn't  
>>> read, so
>>> better code should be
>>> (_, h, g, _) <- runInteractiveCommand "script params"
>>> result <- hGetLine h
>>> hGetContents h >>= evaluate.length
>>> hGetContents g >>= evaluate.length
>> Tangent here, but does anyone else think that something like
>> hGetContentsEagerly would be handy in System.IO?
> YES!
> Jules
> PS we could give it a nice sensible name like hGetContents. We  
> could renaming the existing hGetContents to  
> hUnsafeGetContentsDontUseThisUnlessYouHaveSpentThreeMonthsLearningGHCs 
> ExecutionSemanticsOrYouWillRegretIt

On the contrary, it's great for writing filters.   OTOH, using the  
result of hGetContents interleaved with other IO actions feels like a  
reversion to the bad old days of dialogs (which it is, of course).


More information about the Haskell-Cafe mailing list