cvs commit: fptools/libraries/base/Control Exception.hs fptools/libraries/base/Foreign/C Error.hs fptools/libraries/base/Foreign/M arshal Alloc.hs fptools/libraries/base/GHC Exception.lhs Handle.hs IO.hs IOBase.lhs fptools/libraries/base/System Directory.hs ...

ross@glass.cse.ogi.edu ross@glass.cse.ogi.edu
Thu, 12 Dec 2002 05:42:48 -0800


ross        2002/12/12 05:42:48 PST

  Modified files:
    libraries/base/Control Exception.hs 
    libraries/base/Foreign/C Error.hs 
    libraries/base/Foreign/Marshal Alloc.hs 
    libraries/base/GHC   Exception.lhs Handle.hs IO.hs IOBase.lhs 
    libraries/base/System Directory.hs Environment.hs IO.hs 
    libraries/base/System/IO Error.hs 
    libraries/haskell98  IO.hs 
    libraries/network/Network Socket.hsc 
    libraries/unix/System/Posix IO.hsc 
  Log:
  Changes to the exception interface, as discussed on the libraries list.
  
  1) Move bracket and bracket_ from GHC.Exception (and hence System.IO)
     to haskell98/IO.hs.  These two should now never be used (except in
     all-H98 programs), and this will save users of the new libraries from
     having to hide them.  Use the ones in Control.Exception instead.
  
  2) Define
  
          type IOError = IOException      -- was Exception
  
     leaving the type of Prelude.ioError as IOError -> IO a,
     but adding to Control.Exception
  
          throwIO :: Exception -> IO a
  
  The result is a type distinction between the variants of catch and try:
  
  	Prelude.catch           :: IO a -> (IOError -> IO a) -> IO a
  	Control.Exception.catch :: IO a -> (Exception -> IO a) -> IO a
  	System.IO.Error.try     :: IO a -> IO (Either IOError a)
  	Control.Exception.try   :: IO a -> IO (Either Exception a)
  
  These are breaking changes: the first one affects only import lists,
  but the second will bite in the following situations:
  
  - using ioError on general Exceptions: use throwIO instead.
  
  - using throw on IOErrors: if in the IO monad, use ioError instead.
    Otherwise, use throw (IOException e), but why are you throwing
    IO exceptions outside of the IO monad?
  
  Minor changes:
  - System.IO.Error now exports catch and try
  - moved try from GHC.Exception to System.IO.Error, because it's
    portable and can be shared by Hugs.
  
  Revision  Changes    Path
  1.19      +9 -8      fptools/libraries/base/Control/Exception.hs
  1.13      +2 -2      fptools/libraries/base/Foreign/C/Error.hs
  1.16      +0 -1      fptools/libraries/base/Foreign/Marshal/Alloc.hs
  1.6       +3 -44     fptools/libraries/base/GHC/Exception.lhs
  1.12      +13 -17    fptools/libraries/base/GHC/Handle.hs
  1.10      +2 -2      fptools/libraries/base/GHC/IO.hs
  1.23      +16 -15    fptools/libraries/base/GHC/IOBase.lhs
  1.11      +1 -0      fptools/libraries/base/System/Directory.hs
  1.15      +1 -1      fptools/libraries/base/System/Environment.hs
  1.13      +1 -8      fptools/libraries/base/System/IO.hs
  1.12      +25 -13    fptools/libraries/base/System/IO/Error.hs
  1.4       +32 -0     fptools/libraries/haskell98/IO.hs
  1.29      +2 -2      fptools/libraries/network/Network/Socket.hsc
  1.4       +2 -5      fptools/libraries/unix/System/Posix/IO.hsc