[Haskell-beginners] merge two handles
aslatter at gmail.com
Mon Jun 13 19:51:02 CEST 2011
On Mon, Jun 13, 2011 at 12:35 PM, Manfred Lotz <manfred.lotz at arcor.de> wrote:
> Hi all,
> I have two handles where I get stdout resp. stderr from a command
> Is it possible to merge those two handles so that I get a new input
> handle in a way that data can be read from the new handle whenever it
> is available from either of the two original handles?
Does what you're doing strictly need to be a handle?
One thing you could try is is using an IO Channel:
You can create the channel, then fork off two threads to pump messages
from the handles into the channel, and then read the channel from your
If it does need to be a Handle object, there is probably some GHC
black-magic you can do, but I recommend against it if at all possible.
You can ask for more details if you want.
If you're using unix, there might be something you can do with the
underlying unix file descriptors, but I don't know much about that.
> Beginners mailing list
> Beginners at haskell.org
More information about the Beginners