forkProcess type changed?

Wolfgang Thaller wolfgang.thaller at gmx.net
Thu Dec 11 20:48:38 EST 2003


George Russell wrote:

> For the development snapshot 6.3.20031201, System.Posix.forkProcess
> has the type IO () -> IO System.Posix.Types.ProcessID.  In 6.0.1
> it has type IO () -> IO (Maybe System.Posix.Types.ProcessID).  Is
> this change intentional, and if so how are you supposed to test
> after the fork if this is the parent or child process?

The following example should explain everything:

Old Version:

do
     mbPid <- forkProcess
     case mbPid of
         Nothing -> putStrLn "Child"
         Just pid -> putStrLn $ "Parent of " ++ show pid

New Version:

do
     pid <- forkProcess (putStrLn "Child")
     putStrLn $ "Parent of " ++ show pid



Cheers,

Wolfgang



More information about the Glasgow-haskell-users mailing list