Clarify how one hides Prelude.catch
authorDon Stewart <dons@cse.unsw.edu.au>
Sat, 26 Aug 2006 12:43:46 +0000 (12:43 +0000)
committerDon Stewart <dons@cse.unsw.edu.au>
Sat, 26 Aug 2006 12:43:46 +0000 (12:43 +0000)
User feedback indicated that an example was required, of how to hide
Prelude.catch, so add such an example to the docs

Control/Exception.hs

index 38ead58..f351f87 100644 (file)
@@ -178,11 +178,19 @@ import Data.Dynamic
 -- Also note that the "Prelude" also exports a function called
 -- 'Prelude.catch' with a similar type to 'Control.Exception.catch',
 -- except that the "Prelude" version only catches the IO and user
--- families of exceptions (as required by Haskell 98).  We recommend
--- either hiding the "Prelude" version of
--- 'Prelude.catch' when importing
--- "Control.Exception", or importing
--- "Control.Exception" qualified, to avoid name-clashes.
+-- families of exceptions (as required by Haskell 98).  
+--
+-- We recommend either hiding the "Prelude" version of 'Prelude.catch'
+-- when importing "Control.Exception": 
+--
+-- > import Prelude hiding (catch)
+--
+-- or importing "Control.Exception" qualified, to avoid name-clashes:
+--
+-- > import qualified Control.Exception as C
+--
+-- and then using @C.catch@
+--
 
 catch          :: IO a                 -- ^ The computation to run
        -> (Exception -> IO a)  -- ^ Handler to invoke if an exception is raised