Proposal: derive Typeable for Data.Monoid types

I was surprised to find out that wrappers like Last do not have Typeable instances. Let's add them. Roman

+1
This was already discussed when I noticed the the Generic instances
were missing.
https://ghc.haskell.org/trac/ghc/ticket/8797
Edward suggested that: "The Generic and Generic1 instances clearly
belong with their definitions. They also deserve Typeable and Data."
(...) "FWIW- The committee is in favor of adding the Generic,
Generic1, Data and Typeable instances along with Num for Sum and
Product."
But I guess part of that was lost in the discussion, and did not end
up on the patch. My understanding was that it was supposed to.
There also seemed to be a consensus in raising a new issue (that I
then forgot to raise :( ) to do this for all newtypes in base...
João
2014-05-27 7:38 GMT+01:00 Michael Snoyman
On Tue, May 27, 2014 at 9:31 AM, Roman Cheplyaka
wrote: I was surprised to find out that wrappers like Last do not have Typeable instances. Let's add them.
+1
_______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries

On 2014-05-27 at 08:31:14 +0200, Roman Cheplyaka wrote:
I was surprised to find out that wrappers like Last do not have Typeable instances. Let's add them.
Fyi, Data.Monoid has been given a `{-# LANGUAGE AutoDeriveTypeable #-}` in http://git.haskell.org/ghc.git/commitdiff/1d1ff77aaa09efaddc8cfe0dcf92d67632... which should take care of not forgetting a 'deriving Typeable' in the future for any new entities defined in Data.Monoid.

* Herbert Valerio Riedel
On 2014-05-27 at 08:31:14 +0200, Roman Cheplyaka wrote:
I was surprised to find out that wrappers like Last do not have Typeable instances. Let's add them.
Fyi, Data.Monoid has been given a `{-# LANGUAGE AutoDeriveTypeable #-}` in
http://git.haskell.org/ghc.git/commitdiff/1d1ff77aaa09efaddc8cfe0dcf92d67632...
which should take care of not forgetting a 'deriving Typeable' in the future for any new entities defined in Data.Monoid.
Cool! I take it this is already solved in HEAD, then? Any reason not to enable AutoDeriveTypeable for the whole base (and other core packages)? Roman

On 2014-05-27 at 10:42:30 +0200, Roman Cheplyaka wrote:
* Herbert Valerio Riedel
[2014-05-27 10:36:46+0200] On 2014-05-27 at 08:31:14 +0200, Roman Cheplyaka wrote:
I was surprised to find out that wrappers like Last do not have Typeable instances. Let's add them.
Fyi, Data.Monoid has been given a `{-# LANGUAGE AutoDeriveTypeable #-}` in
http://git.haskell.org/ghc.git/commitdiff/1d1ff77aaa09efaddc8cfe0dcf92d67632...
which should take care of not forgetting a 'deriving Typeable' in the future for any new entities defined in Data.Monoid.
Cool! I take it this is already solved in HEAD, then? Any reason not to enable AutoDeriveTypeable for the whole base (and other core packages)?
You can't enable it everywhere in base due to module-import cycles (you need to import Data.Typeable before you can AutoDeriveTypeable a module), but other than that, the plan is to enable it wherever possible in base. As for other core-packages, it would be sensible to use AutoDeriveTypeable only for packages which don't support GHC versions prior to GHC 7.8 (AutoDeriveTypeable was introduced with GHC 7.8.1).

| You can't enable it everywhere in base due to module-import cycles (you | need to import Data.Typeable before you can AutoDeriveTypeable a | module), but other than that, the plan is to enable it wherever possible | in base. Is someone going to execute on that intention? Thanks! Generally speaking, for every data type in base - either AutoDeriveTypeable should be on - or there should be a standalone deriving clause in Typeable (so that the instance isn't an orphan) Simon
participants (5)
-
Herbert Valerio Riedel
-
João Cristóvão
-
Michael Snoyman
-
Roman Cheplyaka
-
Simon Peyton Jones