On Thu, May 10, 2007 at 09:34:53AM +0100, Simon Marlow wrote: > And we do have support for this in GHC. > > $ ghci > ___ ___ _ > / _ \ /\ /\/ __(_) > / /_\// /_/ / / | | GHC Interactive, version 6.7, for Haskell 98. > / /_\\/ __ / /___| | http://www.haskell.org/ghc/ > \____/\/ /_/\____/|_| Type :? for help. > > Loading package base ... linking ... done. > Prelude> :m + System.IO > Prelude System.IO> h <- openFile "out" WriteMode > {handle: out} > Prelude System.IO> GHC.Handle.hDuplicateTo h stdout > -- as this point, GHCi goes quiet: I type ":quit" > $ cat out > Prelude System.IO> :quit > Leaving GHCi. > > Cheers, > Simon
Is there any way to create a handle which dumps its input into a string or memory buffer of some kind? I only know of the ability to open file/socket handles, and a quick browse of GHC/Handle.hs doesn't seem to indicate anything else. I'm not counting createPipe/fdToHandle because that is not portable. -- -- Matthew Danish -- user: mrd domain: cmu.edu -- OpenPGP public key: C24B6010 on keyring.debian.org _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users