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

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

On Thu, Sep 11, 2014 at 1:20 PM, Herbert Valerio Riedel
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
+1

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@haskell.org http://www.haskell.org/mailman/listinfo/libraries
-- "Elegance is not optional" -- Richard O'Keefe

Hi, Am Donnerstag, den 11.09.2014, 12:25 +0200 schrieb Herbert Valerio Riedel:
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.
in that case, I’m -1. Typeable is not „plain, simple Haskell“, which is what I expect to be in the Prelude. I want a Haskell newbie to be able to read through the prelude and understand and make use of all of it. Greetings, Joachim -- Joachim “nomeata” Breitner mail@joachim-breitner.de • http://www.joachim-breitner.de/ Jabber: nomeata@joachim-breitner.de • GPG-Key: 0xF0FBF51F Debian Developer: nomeata@debian.org

-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"
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@haskell.org http://www.haskell.org/mailman/listinfo/libraries
-- "Elegance is not optional" -- Richard O'Keefe _______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries

Am 11.09.2014 um 12:20 schrieb Herbert Valerio Riedel:
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.
I have still no use for these Typeable things. Additionally I am tired of moving so many things to Prelude. My preference would be that it becomes practice to use the module system, instead of simulating a non-modular language by putting everything into Prelude.

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

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

On 11-09-2014 11:05, Michael Snoyman wrote:
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.
That's an argument for exporting Typeable from Control.Exception, since Prelude does not export Exception and friends. -- Felipe.

Am 11.09.2014 um 16:11 schrieb Felipe Lessa:
On 11-09-2014 11:05, Michael Snoyman wrote:
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.
That's an argument for exporting Typeable from Control.Exception, since Prelude does not export Exception and friends.
For me the Typeable constraint of the Exception class is just an argument to not use implicit exceptions of IO, but instead use one of the various Exception monads with explicit exception types.

On Thu, Sep 11, 2014 at 10:17 AM, Henning Thielemann < schlepptop@henning-thielemann.de> wrote:
Am 11.09.2014 um 16:11 schrieb Felipe Lessa:
On 11-09-2014 11:05, Michael Snoyman wrote:
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.
That's an argument for exporting Typeable from Control.Exception, since Prelude does not export Exception and friends.
For me the Typeable constraint of the Exception class is just an argument to not use implicit exceptions of IO, but instead use one of the various Exception monads with explicit exception types.
Not to mention that "...want it to be easier for people to define their own exception types" really makes me think something's gone wrong with the design somewhere. Exceptions ought to be ... exceptional, not common enough that people regularly need to define their own. -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net

On Thu, Sep 11, 2014 at 4:25 PM, Brandon Allbery
On Thu, Sep 11, 2014 at 10:17 AM, Henning Thielemann
wrote: Am 11.09.2014 um 16:11 schrieb Felipe Lessa:
On 11-09-2014 11:05, Michael Snoyman wrote:
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.
That's an argument for exporting Typeable from Control.Exception, since Prelude does not export Exception and friends.
For me the Typeable constraint of the Exception class is just an argument to not use implicit exceptions of IO, but instead use one of the various Exception monads with explicit exception types.
Not to mention that "...want it to be easier for people to define their own exception types" really makes me think something's gone wrong with the design somewhere. Exceptions ought to be ... exceptional, not common enough that people regularly need to define their own.
I thought the whole point of extensible exceptions was to define your own? That way you can catch them, instead of just piling them all together. I get that there are people who think you shouldn't use exceptions at all, but for the people who *do* use them, I think they should almost always define a new type for each one. Erik

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 - -1. - -- Alexander alexander@plaimi.net https://secure.plaimi.net/~alexander -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iF4EAREIAAYFAlQSw9sACgkQRtClrXBQc7WTAQD+Ir7dDzvfvWQ3z2l8OYF5zQmm D16L/e0HJCG0zorYr0QA/isRfKETQ87e2SOdiZ65PvZbbikalRcupp8EZbUzkXQ1 =92Au -----END PGP SIGNATURE-----

After some deliberation on this I think I also come down -1 on this
proposal.
default-extensions: AutoDeriveTypeable
doesn't need it, so there is no technical reason to encumber everyone with
it. It'd cause a huge spate of warnings that'd force everyone to mangle
their import list in different ways with CPP, and without the methods for
working with it most users'd have to import more from Data.Typeable anyways.
-Edward
On Thu, Sep 11, 2014 at 6:20 AM, Herbert Valerio Riedel
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
participants (11)
-
Alexander Berntsen
-
Anthony Cowley
-
Brandon Allbery
-
David Feuer
-
Edward Kmett
-
Erik Hesselink
-
Felipe Lessa
-
Henning Thielemann
-
Herbert Valerio Riedel
-
Joachim Breitner
-
Michael Snoyman