[Haskell-beginners] ghc-6.10.3 IOException?

Daniel Fischer daniel.is.fischer at web.de
Sat Jun 13 20:14:06 EDT 2009


Am Sonntag 14 Juni 2009 01:58:06 schrieb Erik de Castro Lopo:
> Hi all,
>
> I have some code (basically from http://sequence.complete.org/node/257)
> which  has:
>
>     import Control.Exception (finally, catch, Exception (..), IOException)
>
> ...
>
>     handler (IOException e)
>
>         | isEOFError e = return ()
>
> but gch-6.10.3 still says
>
>     Not in scope: data constructor `IOException'
>
> Someone smack me with the cluestick please :-).
>

a) you only imported the type, not the data constructor(s)
b) confusingly, the constructor of IOException is IOError:

data IOException
 = IOError {
     ioe_handle   :: Maybe Handle,   -- the handle used by the action flagging 
                                     -- the error.
     ioe_type     :: IOErrorType,    -- what it was.
     ioe_location :: String,         -- location.
     ioe_description :: String,      -- error type specific information.
     ioe_filename :: Maybe FilePath  -- filename the error is related to.
   }
    deriving Typeable

instance Exception IOException



> Cheers,
> Erik



More information about the Beginners mailing list