[Haskell-cafe] A yet another question about subtyping and heterogeneous collections
First of all, MigMit has probably suggested the parameterization of Like by the constraint, something like the following: data Like ctx = forall a. (ctx a, Typeable a) = Like a instance ALike (Like ALike) where toA (Like x) = toA x instance CLike (Like CLike) where toC (Like x) = toC x get_mono :: Typeable b = [Like ALike] - [b] get_mono = catMaybes . map ((\(Like x) - cast x)) lst_a :: [Like ALike] lst_a = [Like a1, Like b1, Like c1, Like d1] lst_c :: [Like CLike] lst_c = [Like c1, Like d1] t1 = map print_a lst_a t2 = map print_a lst_c (The rest of the code is the same as in your first message). You need the flag ConstraintKinds. Second, all your examples so far used structural subtyping (objects with the same fields have the same type) rather than nominal subtyping of C++ (distinct classes have distinct types even if they have the same fields; the subtyping must be declared in the class declaration). For the structural subtyping, upcasts and downcasts can be done mostly automatically. See the OOHaskell paper or the code http://code.haskell.org/OOHaskell (see the files in the samples directory). ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] How to correctly benchmark code with Criterion?
Thank you very much Thomas. This is the kind of explanation I needed! Janek Dnia czwartek, 18 października 2012, Thomas Schilling napisał: On 18 October 2012 13:15, Janek S. fremenz...@poczta.onet.pl wrote: Something like this might work, not sure what the canonical way is. (...) This is basically the same as the answer I was given on SO. My concerns about this solutions are: - rnf requires its parameter to belong to NFData type class. This is not the case for some data structures like Repa arrays. For unboxed arrays of primitive types WHNF = NF. That is, once the array is constructed all its elements will be in WHNF. - evaluate only evaluates its argument to WHNF - is this enough? If I have a tuple containing two lists won't this only evaluate the tuple construtor and leave the lists as thunks? This is actually the case in my code. That is why you use rnf from the NFData type class. You use evaluate to kick-start rnf which then goes ahead and evaluates everything (assuming the NFData instance has been defined correctly.) As I said previously, it seems that Criterion somehow evaluates the data so that time needed for its creation is not included in the benchmark. I modified my dataBuild function to look lik this: dataBuild gen = unsafePerformIO $ do let x = (take 6 $ randoms gen, take 2048 $ randoms gen) delayThread 100 return x When I ran the benchmark, criterion estimated the time needed to complete it to over 100 seconds (which means that delayThread worked and was used as a basis for estimation), but the benchamrk was finished much faster and there was no difference in the final result comparing to the normal dataBuild function. This suggests that once data was created and used for estimation, the dataBuild function was not used again. The main question is: is this observation correct? In this question on SO: http://stackoverflow.com/questions/6637968/how-to-use-criterion-to-measur e-performance-of-haskell-programs one of the aswers says that there is no automatic memoization, while it looks that in fact the values of dataBuild are memoized. I have a feeling that I am misunderstanding something. If you bind an expression to a variable and then reuse that variable, the expression is only evaluated once. That is, in let x = expr in ... the expression is only evaluated once. However, if you have f y = let x = expr in ... then the expression is evaluated once per function call. I don't know if you have already read them, but Tibell's slides on High Performance Haskell are pretty good: http://www.slideshare.net/tibbe/highperformance-haskell There is a section at the end where he runs several tests using Criterion. I skimmed the slides and slide 59 seems to show that my concerns regarding WHNF might be true. It's usually safe if you benchmark a function. However, you most likely want the result to be in normal form. The nf does this for you. So, if your benchmark function has type f :: X - ([Double], Double), your benchmark will be: bench f (nf f input) The first run will evaluate the input (and discard the runtime) and all subsequent runs will evaluate the result to normal form. For repa you can use deepSeqArray [1] if your array is not unboxed: bench f' (whnf (deepSeqArray . f) input) [1]: http://hackage.haskell.org/packages/archive/repa/3.2.2.2/doc/html/Data-Arra y-Repa.html#v:deepSeqArray ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] A yet another question about subtyping and heterogeneous collections
On 10/19/2012 06:14 AM, AntC wrote: Roman Cheplyaka roma at ro-che.info writes: * Dmitry Vyal akamaus at gmail.com [2012-10-18 17:31:13+0400] On 10/18/2012 03:20 PM, MigMit wrote: Why do you need ALike x, BLike x etc.? Why not just Like u x? Hmm, looks like a nice idea. I tried it, unfortunately I can't cope with compiler error messages: tst.hs:32:15: Context reduction stack overflow; size = 201 Use -fcontext-stack=N to increase stack size to N Upcast a b In the first argument of `(.)', namely `(upcast :: b - a)' In the expression: (upcast :: b - a) . (upcast :: c - b) In the expression: (upcast :: b - a) . (upcast :: c - b) $ x instance (Upcast a b, Upcast b c) = Upcast a c where upcast = (upcast :: b - a) . (upcast :: c - b) This is the offending instance. Remember, GHC only looks at the instance head (Upcast a c here) when it decides which instance to use. Roman Hi Dmitry, looks like you've got the classic (show . read) difficulty. In your Upcast a c instance, the compiler is trying to figure out the type of b. You might think there's only one 'chain' to get from (say) type A to type D -- that is via Upcast A B to Upcast B C to Upcast C D; but there's also an instance Upcast x x -- which means there could be any number of Upcast A A, Upcast B B, etc links in the chain. (And this doesn't count all the other possible instances that might be defined in other modules -- for all the compiler knows at that point.) The modern way to handle this is using type functions (aka type families aka associated types), but I'm not sure how that would apply here. (And, for the record, the old-fashioned way would use functional dependencies, as per the Heterogenous Collections paper aka 'HList's). AntC Hello Antony, do I understand you correctly, that the error message is the result of compiler using depth first search of some kind when calculating instances? Also can you please elaborate a bit more on using functional dependencies for this problem? Upcast x y is not a function, it's a relation, y can be upcasted to different x'es and different y's can be upcasted to single x. Dmitry ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Build GHC to i386 platform represent an error after run command make bootstrapping-files
Hello All, I using GHC for x86_64 platform compiles the GHC source in order to port code to the i386 platform. Steps for building GHC to i386 platform at link[1]. Configure before initial other steps as completed follow by $./configure --enable-hc-boot --build=i386-unknown-linux --host=i386-unknown-linux --target=i386-unknown-linux --with-gcc=/usr/bin/gcc --with-ld=/usr/bin/ld --with-nm=/usr/bin/nm --with-ghc=/usr/lib/ghc/bin/ghc -- Configure completed successfully. Building GHC version : 7.7.20120806 Build platform: i386-unknown-linux Host platform : i386-unknown-linux Target platform : i386-unknown-linux Bootstrapping from HC files. Using GCC : /usr/bin/gcc which is version : 4.6.3 Building a cross compiler : NO Porting to foreign arch : NO Alien script : ld : /usr/bin/ld Happy: () Alex : () Python : /usr/bin/python Perl : /usr/bin/perl dblatex : xsltproc : HsColour was not found; documentation will not contain source links Building DocBook HTML documentation : NO Building DocBook PS documentation : NO Building DocBook PDF documentation : NO -- Next step for making executable file by command make bootstrapping-files. It's show an error such as below. $ make bootstrapping-files make -r --no-print-directory -f ghc.mk bootstrapping-files /usr/bin/find: `libraries/ghc-prim/dist-install/build': No such file or directory /usr/bin/find: `libraries/ghc-prim/dist-install/build': No such file or directory /usr/bin/find: `libraries/integer-gmp/dist-install/build': No such file or directory /usr/bin/find: `libraries/integer-gmp/dist-install/build': No such file or directory /usr/bin/find: `libraries/base/dist-install/build': No such file or directory /usr/bin/find: `libraries/base/dist-install/build': No such file or directory /usr/bin/find: `libraries/filepath/dist-install/build': No such file or directory /usr/bin/find: `libraries/filepath/dist-install/build': No such file or directory /usr/bin/find: `libraries/array/dist-install/build': No such file or directory /usr/bin/find: `libraries/array/dist-install/build': No such file or directory /usr/bin/find: `libraries/deepseq/dist-install/build': No such file or directory /usr/bin/find: `libraries/deepseq/dist-install/build': No such file or directory /usr/bin/find: `libraries/bytestring/dist-install/build': No such file or directory /usr/bin/find: `libraries/bytestring/dist-install/build': No such file or directory /usr/bin/find: `libraries/containers/dist-install/build': No such file or directory /usr/bin/find: `libraries/containers/dist-install/build': No such file or directory /usr/bin/find: `libraries/old-locale/dist-install/build': No such file or directory /usr/bin/find: `libraries/old-locale/dist-install/build': No such file or directory /usr/bin/find: `libraries/old-time/dist-install/build': No such file or directory /usr/bin/find: `libraries/old-time/dist-install/build': No such file or directory /usr/bin/find: `libraries/time/dist-install/build': No such file or directory /usr/bin/find: `libraries/time/dist-install/build': No such file or directory /usr/bin/find: `libraries/unix/dist-install/build': No such file or directory /usr/bin/find: `libraries/unix/dist-install/build': No such file or directory /usr/bin/find: `libraries/directory/dist-install/build': No such file or directory /usr/bin/find: `libraries/directory/dist-install/build': No such file or directory /usr/bin/find: `libraries/process/dist-install/build': No such file or directory /usr/bin/find: `libraries/process/dist-install/build': No such file or directory /usr/bin/find: `libraries/hpc/dist-boot/build': No such file or directory /usr/bin/find: `libraries/hpc/dist-boot/build': No such file or directory /usr/bin/find: `libraries/hpc/dist-install/build': No such file or directory /usr/bin/find: `libraries/hpc/dist-install/build': No such file or directory /usr/bin/find: `libraries/pretty/dist-install/build': No such file or directory /usr/bin/find: `libraries/pretty/dist-install/build': No such file or directory /usr/bin/find: `libraries/template-haskell/dist-install/build': No such file or directory /usr/bin/find: `libraries/template-haskell/dist-install/build': No such file or directory /usr/bin/find: `libraries/Cabal/Cabal/dist-boot/build': No such file or directory /usr/bin/find: `libraries/Cabal/Cabal/dist-boot/build': No such file or directory /usr/bin/find: `libraries/Cabal/Cabal/dist-install/build': No such file or directory /usr/bin/find: `libraries/Cabal/Cabal/dist-install/build': No such file or directory /usr/bin/find: `libraries/binary/dist-boot/build': No such file or directory /usr/bin/find: `libraries/binary/dist-boot/build': No such file or directory
Re: [Haskell-cafe] acid-state audit trail
The history is there until you archive (move a checkpoint out into a separate directory) it and then delete the archive yourself. the checkpointing just reduces the recovery time (i.e creates a fixed point in time), if you were to keep all the checkpoint/archives then you would have the complete history Neil On 19 Oct 2012, at 06:18, Richard Wallace rwall...@thewallacepack.net wrote: Hey all, I've been looking at acid-state as a possible storage backend for an application. It looks like it fits my needs pretty damn well, but one thing that I'm curious about is if it is possible to get a list of update events. You can obviously query for the current state, but it's not immediately apparent if you can see the history of your values state. This is useful in some things, like providing audit trails and debugging. As well as being able to re-create state in a different form. I was also curious if the createCheckpoint function eliminates the state history or does it just create a snapshot, it's not apparent from the docs. Thanks, Rich ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Adding custom events to eventlog
Dear list, I'm using ThreadScope to improve performance of my parallel program. It would be very helpful for me if I could place custom things in eventlog (e.g. now function x begins). Is this possible? Janek ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Erroneous interaction between DataKinds and ExistentialQuantification?
Quite right -- a bug. Thank you. I'll add it to the regression suite Simon | -Original Message- | From: haskell-cafe-boun...@haskell.org [mailto:haskell-cafe- | boun...@haskell.org] On Behalf Of Stefan Holdermans | Sent: 17 October 2012 21:45 | To: Haskell Cafe | Cc: José Pedro Magalhães | Subject: [Haskell-cafe] Erroneous interaction between DataKinds and | ExistentialQuantification? | | I am almost sure this is a known issue, but I noticed some erroneous (?) | interaction between datatype promotion and existential quantification. Consider | the following program: | |{-# LANGUAGE DataKinds #-} |{-# LANGUAGE ExistentialQuantification #-} |{-# LANGUAGE GADTs #-} |{-# LANGUAGE KindSignatures#-} | |module Test where | |data K = forall a. T a -- promotion gives 'T :: * - K | |data G :: K - * where | D :: G (T []) -- kind error! | | I would expect the type checker to reject it, but GHC (version 7.6.1) compiles it | happily. Is this indeed a (known) bug? | | On a related note: is there a way to promote a type that involves an existential | type variable of a kind other than *? | | Thanks, | |Stefan | ___ | Haskell-Cafe mailing list | Haskell-Cafe@haskell.org | http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Adding custom events to eventlog
Janek S. fremenz...@poczta.onet.pl writes: Dear list, I'm using ThreadScope to improve performance of my parallel program. It would be very helpful for me if I could place custom things in eventlog (e.g. now function x begins). Is this possible? Yes, it certainly is possible. Have a look at Debug.Trace.traceEvent and traceEventIO. I have found these to be a remarkably powerful tool for understanding parallel performance. Cheers, - Ben ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Adding custom events to eventlog
That's what I was looking for. Thanks! Dnia piątek, 19 października 2012, Ben Gamari napisał: Janek S. fremenz...@poczta.onet.pl writes: Dear list, I'm using ThreadScope to improve performance of my parallel program. It would be very helpful for me if I could place custom things in eventlog (e.g. now function x begins). Is this possible? Yes, it certainly is possible. Have a look at Debug.Trace.traceEvent and traceEventIO. I have found these to be a remarkably powerful tool for understanding parallel performance. Cheers, - Ben ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Release Candidate 2: HP 2014.4.0.0
Haskellistas - The second release candidate of HP 2014.4.0.0 is now available: - Source tarball: haskell-platform-2012.4.0.0-rc2.tar.gzhttp://ozonehouse.com/mark/platform/haskell-platform-2012.4.0.0-rc2.tar.gz - Mac 32-bit installer: Haskell Platform 2012.4.0.0 32bit rc2 signed.pkghttp://ozonehouse.com/mark/platform/Haskell%20Platform%202012.4.0.0%2032bit%20rc2%20signed.pkg Mac notes: This version is now digitally signed by me, and so will install without fuss on OS X 10.8. I'll put up 64-bit version soon. - Mark Changes since RC1: TODO [x] update vector and primitive versions (they had a point release to fix a bad bug, and the fix was very very simple) [x] remove Build.hs - it did all its work by shelling out anyway! [x] main .cabal file should not have versions commented out [x] this will require a way to extract the list of packages that need to be part of the source release [x] why not also extract the list of packages needed for core.packages [x] fix to build.hs (ticket #195) [x] bugs in build.sh (ticket #197) [x] build instructions in the tarball (ticket #207) [x] merge in shared library patch (ticket #198) MAC TODO [x] mac cabal script needs to quote things with $HOME or ~ in them (ticket #192) [x] If the cabal command is update then the wrapper script shouldn't do an update the first time through! [x] sign Mac installers (ticket #203) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] acid-state audit trail
Ok, cool. Any idea if you can get a list of events, or can you just get the latest state? Thanks, Rich On Oct 19, 2012 3:53 AM, Neil Davies semanticphilosop...@gmail.com wrote: The history is there until you archive (move a checkpoint out into a separate directory) it and then delete the archive yourself. the checkpointing just reduces the recovery time (i.e creates a fixed point in time), if you were to keep all the checkpoint/archives then you would have the complete history Neil On 19 Oct 2012, at 06:18, Richard Wallace rwall...@thewallacepack.net wrote: Hey all, I've been looking at acid-state as a possible storage backend for an application. It looks like it fits my needs pretty damn well, but one thing that I'm curious about is if it is possible to get a list of update events. You can obviously query for the current state, but it's not immediately apparent if you can see the history of your values state. This is useful in some things, like providing audit trails and debugging. As well as being able to re-create state in a different form. I was also curious if the createCheckpoint function eliminates the state history or does it just create a snapshot, it's not apparent from the docs. Thanks, Rich ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Release Candidate 2: HP 2014.4.0.0
That's VERY efficient (2014 editions out in 2012). :-) On 19 October 2012 16:37, Mark Lentczner mark.lentcz...@gmail.com wrote: Haskellistas - The second release candidate of HP 2014.4.0.0 is now available: Source tarball: haskell-platform-2012.4.0.0-rc2.tar.gz Mac 32-bit installer: Haskell Platform 2012.4.0.0 32bit rc2 signed.pkg Mac notes: This version is now digitally signed by me, and so will install without fuss on OS X 10.8. I'll put up 64-bit version soon. - Mark Changes since RC1: TODO [x] update vector and primitive versions (they had a point release to fix a bad bug, and the fix was very very simple) [x] remove Build.hs - it did all its work by shelling out anyway! [x] main .cabal file should not have versions commented out [x] this will require a way to extract the list of packages that need to be part of the source release [x] why not also extract the list of packages needed for core.packages [x] fix to build.hs (ticket #195) [x] bugs in build.sh (ticket #197) [x] build instructions in the tarball (ticket #207) [x] merge in shared library patch (ticket #198) MAC TODO [x] mac cabal script needs to quote things with $HOME or ~ in them (ticket #192) [x] If the cabal command is update then the wrapper script shouldn't do an update the first time through! [x] sign Mac installers (ticket #203) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] acid-state audit trail
Right now acid-state always tries to restore everything up through the latest events. The long term plan is to create an acid-state tool that would allow you to rollback the event log, list and examine specific events, etc. So, it is possible in theory, and not even that hard, but no one has done the work yet. - jeremy On Fri, Oct 19, 2012 at 10:38 AM, Richard Wallace rwall...@thewallacepack.net wrote: Ok, cool. Any idea if you can get a list of events, or can you just get the latest state? Thanks, Rich On Oct 19, 2012 3:53 AM, Neil Davies semanticphilosop...@gmail.com wrote: The history is there until you archive (move a checkpoint out into a separate directory) it and then delete the archive yourself. the checkpointing just reduces the recovery time (i.e creates a fixed point in time), if you were to keep all the checkpoint/archives then you would have the complete history Neil On 19 Oct 2012, at 06:18, Richard Wallace rwall...@thewallacepack.net wrote: Hey all, I've been looking at acid-state as a possible storage backend for an application. It looks like it fits my needs pretty damn well, but one thing that I'm curious about is if it is possible to get a list of update events. You can obviously query for the current state, but it's not immediately apparent if you can see the history of your values state. This is useful in some things, like providing audit trails and debugging. As well as being able to re-create state in a different form. I was also curious if the createCheckpoint function eliminates the state history or does it just create a snapshot, it's not apparent from the docs. Thanks, Rich ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] A yet another question about subtyping and heterogeneous collections
Second, all your examples so far used structural subtyping (objects with the same fields have the same type) rather than nominal subtyping of C++ (distinct classes have distinct types even if they have the same fields; the subtyping must be declared in the class declaration). For the structural subtyping, upcasts and downcasts can be done mostly automatically. See the OOHaskell paper or the code Hello Oleg, I've glanced over both HList and OOHaskell papers when I considered taking different approaches. Albeit elegant, OOHaskell looked too heavy for my purposes, I don't need mutability, for example. And HList paper left me with two questions. The first one is how much such an encoding costs both in terms of speed and space. And the second one is can I conveniently define a Storable instance for hlists. As I said before, I need all this machinery to parse a great number of serialized nested C structs from a file. Best regards Dmitry ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] tplot (out of memory)
Hi, I didn't - because I didn't run into this myself. Manish, maybe you did? :) On Thu, Oct 18, 2012 at 1:55 AM, malcolm.wallace malcolm.wall...@me.com wrote: Did you ever solve this? I have a similar message ( user error (out of memory) ) arising from a different app (not tplot) that uses the Haskell Chart library (and cairo underneath). On some linux machines, it crashes, on others it works fine. I can find no environment differences between the machines. The app does not use a lot of memory, and the machine is not running out of physical or swap. Regards, Malcolm On 04 Sep, 2012,at 04:01 PM, Eugene Kirpichov ekirpic...@gmail.com wrote: Hi Manish, Please provide the input file, I'll debug this. On Mon, Sep 3, 2012 at 1:06 PM, Manish Trivedi trivman...@gmail.com wrote: Hi, I am running into a weird out of memory issue. While running timeplot over an input file having ~800 rows. From below provided info, seems like machine has enough ram (1849MB). Please let me know if anyone has pointers. # free -m total used free shared buffers cached Mem: 3825 1975 1849 0 13 71 -/+ buffers/cache: 1891 1934 Swap: 4031 111 3920 #time tplot -o out.png -or 1024x768 -k 'CurrentPerHour' 'lines' -k 'RequiredPerHour' 'lines' -if adgroup_delivery_chart.input -tf 'date %Y-%m-%d %H:%M:%OS' tplot: user error (out of memory) real 0m0.026s user 0m0.018s sys 0m0.008s -Manish ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Eugene Kirpichov http://www.linkedin.com/in/eugenekirpichov ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe -- Eugene Kirpichov http://www.linkedin.com/in/eugenekirpichov We're hiring! http://tinyurl.com/mirantis-openstack-engineer ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Getting PID of a child process
2012/10/19 Donn Cave d...@avvanta.com: Quoth Jason Dusek jason.du...@gmail.com, Using `System.Process.runInteractiveProcess', I can start a process and get a handle to it: runInteractiveProcess :: FilePath - [String] - Maybe FilePath - Maybe [(String, String)] - IO (Handle, Handle, Handle, ProcessHandle) For diagnostic purposes, I'd like to print the PID of the process attached to this handle -- how best to do that? There's a good chance this isn't the best way, but it seems to work: import System.Process import System.Process.Internals (ProcessHandle__(..), PHANDLE, withProcessHandle) -- for use with withProcessHandle getPID :: ProcessHandle__ - IO (ProcessHandle__, Maybe PHANDLE) getPID h@(OpenHandle t) = return (h, Just t) getPID h@(ClosedHandle t) = return (h, Nothing) main = do (h0, h1, h2, hp) - runInteractiveProcess /bin/date [] Nothing Nothing mp - withProcessHandle hp $ getPID print mp Seems like more scaffolding than this application really ought to require. It seems wrong that in the definition of ProcessHandle__, the PID is not recoverable once the process has exited. I wonder if this has something to do with Windows compatibility. -- Jason Dusek pgp // solidsnack // C1EBC57DC55144F35460C8DF1FD4C6C1FED18A2B ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe