Forwarding response to cafe
---------- Forwarded message ---------- From: Antoine Latter <[email protected]> Date: Sun, Jan 4, 2009 at 2:13 PM Subject: Re: [Haskell-cafe] Auto-deriving Control.Exception.Exception To: "[email protected]" <[email protected]> On Sun, Jan 4, 2009 at 11:50 AM, [email protected] <[email protected]> wrote: > If this is valid: > > import qualified Control.Exception as Exc > > genericFromException :: Typeable a => Exc.SomeException -> Maybe a > genericFromException (Exc.SomeException e) = cast e > instance Exc.Exception SomeType where fromException = > genericFromException > > then why not have an auto-deriving rule for Exception (fromException = > cast . unSomeException)? If you just say: > instance Exception YourType where and leave the instance body empty, it will use the default definitions of 'fromException' and 'toException', which do the right thing by default. At least, I'm pretty sure that's what happens. The Haddock docs have lost their links to the source code. -Antoine _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
