[Haskell-beginners] ghc-6.10.3 IOException?

Daniel Fischer daniel.is.fischer at web.de
Sun Jun 14 08:27:32 EDT 2009


Am Sonntag 14 Juni 2009 06:33:07 schrieb Erik de Castro Lopo:
> Daniel Fischer wrote:
> > 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
>
> Ok, I can see whats wrong, but I still have no idea how to fix it.
>
> Erik

Ah, I didn't follow the link yesterday, that code is from 2007.
With ghc-6.10, Control.Exception has been revamped, Exception is no longer a datatype but 
a type class.
Before 6.10, IOException was a constructor of Exception.

Simple solution:
import Control.OldException instead of Control.Exception

Harder long-time solution: 
rewrite the code to work with the new system.

I would first use the simple solution and then see whether it's worth the rewrite.

Cheers,
Daniel


More information about the Beginners mailing list