Forwarding response to cafe
---------- Forwarded message ---------- From: Antoine Latter <aslat...@gmail.com> Date: Sun, Jan 4, 2009 at 2:13 PM Subject: Re: [Haskell-cafe] Auto-deriving Control.Exception.Exception To: "eyal.lo...@gmail.com" <eyal.lo...@gmail.com> On Sun, Jan 4, 2009 at 11:50 AM, eyal.lo...@gmail.com <eyal.lo...@gmail.com> 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 Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe