Re: [Haskell-cafe] Problem with a sample from RWH

2010-09-30 Thread C K Kashyap
> The change looks good; note, however, that you're doing something > subtly different if an error occurs: in the original, if an error > occured then "fail" was used to forcibly terminate the program.  Your > variant however returns the shown error message.  Depending on the > situation, this is u

Re: [Haskell-cafe] Problem with a sample from RWH

2010-09-29 Thread Ivan Lazar Miljenovic
On 30 September 2010 16:46, C K Kashyap wrote: > > Could you please review the change I've done to Don Stewart's > scripting example - > > run s = handle (fail . show) $ do >    (ih,oh,eh,pid) <- runInteractiveCommand s >    so <- hGetContents oh >    se <- hGetContents eh >    hClose ih >    ex <

Re: [Haskell-cafe] Problem with a sample from RWH

2010-09-29 Thread C K Kashyap
Thanks Ivan, > > * Keep using old-style exceptions.  With GHC 6.10 and 6.12, import > Control.OldException instead of Control.Exception > * Manually migrate the RWH code to new-style exceptions; there are two > ways of doing this: >  - For production code, you should add explicit type signatures,

Re: [Haskell-cafe] Problem with a sample from RWH

2010-09-29 Thread Ivan Lazar Miljenovic
On 30 September 2010 15:23, C K Kashyap wrote: > Hi, > I was going over the Error Handling chapter in RWH and tried out this sample - > > Prelude> :m Control.Exception > Prelude Control.Exception> let x=5 `div` 0 > Prelude Control.Exception> let y=5 `div` 1 > Prelude Control.Exception> handle (\_

[Haskell-cafe] Problem with a sample from RWH

2010-09-29 Thread C K Kashyap
Hi, I was going over the Error Handling chapter in RWH and tried out this sample - Prelude> :m Control.Exception Prelude Control.Exception> let x=5 `div` 0 Prelude Control.Exception> let y=5 `div` 1 Prelude Control.Exception> handle (\_ -> putStrLn "Text") (print x) :1:0: Ambiguous type varia