PROPOSAL: re-export 'Typeable' type-class from Prelude

David Feuer david.feuer at gmail.com
Thu Sep 11 13:25:33 UTC 2014


-1. The Prelude is, for the most part, stuff in the standard. I don't think
Typeable has much chance of ever getting there.
On Sep 11, 2014 6:25 AM, "Herbert Valerio Riedel" <hvr at gnu.org> wrote:

>
> UPDATE: I was just made aware that 'AutoDeriveTypeable' does in fact *not*
>         require 'Typeable' to be in scope. So the proposal still stands,
>         but with less motivation.
>
> On 2014-09-11 at 12:20:11 +0200, 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 at haskell.org
> > http://www.haskell.org/mailman/listinfo/libraries
>
> --
> "Elegance is not optional" -- Richard O'Keefe
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20140911/569f40a1/attachment.html>


More information about the Libraries mailing list