Ian,

this patch makes a subtle change to the semantics of tryUser in Panic.hs, used in the TcRnMonad.
The relevant code is pasted at the bottom of this email.

In >=6.9, tryUser catches also ErrorCalls, but in <6.9 it didn't,
as isUserError in <6.9 does not apply to Error calls.

I wonder if this is intended or just an oversight*.
The new semantics would require some quite annoying changes in the code for :print

Thanks,
pepe

* - A reasonably recent HEAD still validates if I remove the lines that catch an ErrorCall.


On 31/07/2008, at 23:09, Ian Lynagh wrote:

Thu Jul 31 10:33:54 PDT 2008  Ian Lynagh <[EMAIL PROTECTED]>
 * Follow changes in the base library
 TopHandler now uses the new extensible exceptions module, so we
 need to interact with it using the new types.

   M ./compiler/ghci/GhciMonad.hs -5 +3
   M ./compiler/ghci/InteractiveUI.hs -8 +20
   M ./compiler/ghci/Linker.lhs -1 +1
   M ./compiler/main/DriverMkDepend.hs -3 +4
   M ./compiler/main/DriverPipeline.hs -1 +1
   M ./compiler/main/ErrUtils.lhs -1 +23
   M ./compiler/main/GHC.hs -27 +54
   M ./compiler/main/HeaderInfo.hs -1 +1
   M ./compiler/main/InteractiveEval.hs -2 +18
   M ./compiler/main/Packages.lhs -2 +4
   M ./compiler/typecheck/TcRnMonad.lhs -1 +6
   M ./compiler/typecheck/TcSplice.lhs +12
   M ./compiler/utils/Exception.hs -7 +30
   M ./compiler/utils/IOEnv.hs -3 +9
   M ./compiler/utils/Panic.lhs -6 +80
   M ./compiler/utils/Util.lhs -19



-- | tryUser is like try, but catches only UserErrors.
-- These are the ones that are thrown by the TcRn monad -- to signal an error in the program being compiled
#if __GLASGOW_HASKELL__ < 609
tryUser :: IO a -> IO (Either Exception.Exception a)
tryUser action = tryJust tc_errors action
  where
        tc_errors e@(Exception.IOException ioe) | isUserError ioe = Just e
        tc_errors _other = Nothing
#else
tryUser :: IO a -> IO (Either ErrorCall a)
tryUser io =
    do ei <- try io
       case ei of
           Right v -> return (Right v)
           Left se@(SomeException ex) ->
               case cast ex of
               -- Look for good old fashioned ErrorCall's
               Just errorCall -> return (Left errorCall)
               Nothing ->
                   case cast ex of
                   -- And also for user errors in IO errors.
                   -- Sigh.
                   Just ioe
                    | isUserError ioe ->
return (Left (ErrorCall (ioeGetErrorString ioe)))
                   _ -> throw se
#endif

_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to