
The one case I think Typeable should *always* be around for is creating new
instances of Exception. The fact that AutoDeriveTypeable doesn't require
Typeable in Prelude lessens my +1 a bit down to a +0.5, but I really want
it to be easier for people to define their own exception types.
On Thu, Sep 11, 2014 at 4:57 PM, Anthony Cowley
I'm -1 on this as I'm not yet convinced that reaching for Typeable should be such a quick decision that it deserves to always be in scope.
Anthony
On Sep 11, 2014, at 6:20 AM, Herbert Valerio Riedel
wrote: TL;DR =====
Re-export 'Data.Typeable.Typeable' from 'Prelude'
Motivation ==========
Since GHC 7.8 the ubiquitous 'Typeable' instances can only be auto-derived via `... deriving Typeable`, moreover there's a new extension `-XAutoDeriveTypeable` which implicitly auto-derives 'Typeable' for all defined types in modules for which that extension is enabled.
However, even if you enable `-XAutoDeriveTypeable` you still need to explicitly bring the 'Typeable' class into scope, with e.g.
import Data.Typeable (Typeable)
otherwise GHC complains with
Not in scope: type constructor or class ‘Typeable’
Since at this point it's become current practice to have 'Typeable' instances for most types, it would be beneficial to save an 'import Data.Typeable (Typeable)' line for the sole purpose of deriving such instances.
By having 'Prelude' re-export 'Typeable' from GHC 7.10 on (should this proposal be implemented) it would suffice to have a
default-extensions: -XAutoDeriveTypeable`
in the Cabal file and have 'Typeable' instance auto-derived for all types defined in a package w/o any source changes (unless there's a name-clash with 'Typeable')
Discussion period =================
The usual 2 weeks _______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries
Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries