ekmett / tagged

phantom types
http://hackage.haskell.org/package/tagged
BSD 3-Clause "New" or "Revised" License
37 stars 26 forks source link

Define KProxy, Generic instances for base compatibility #25

Closed RyanGlScott closed 9 years ago

RyanGlScott commented 9 years ago

There's currently some discrepancies between the Data.Proxy modules provided by base and tagged, so I retrofitted old/Data/Proxy.hs with the missing features:

Since there's a Generic (Proxy s) instance now, I went ahead and added Generic and Generic1 instances for Tagged as well.

I didn't create a Generic1 Proxy instance since (1) base doesn't define one and (2) data Proxy s = Proxy deriving Generic1 breaks on GHC 7.6 due to a strange bug with PolyKinds. If base ever decides to define a Generic1 instance, I suppose a Generic1 Proxy instance could be defined by hand to get around this.

RyanGlScott commented 9 years ago

Oops, it occurred to me that that data KProxy (t :: *) isn't Haskell98. I updated it to use CPP pragmas such that kind signatures are only employed in the presence of PolyKinds.

RyanGlScott commented 9 years ago

One more thing I forgot about was that GHC 7.10.1 derives Typeable instances for all data types automatically, so I also added a deriving Typeable KProxy clause.

However, I'm not sure if a derived instance is what you'd want in tagged, since I noticed you manually implemented Typeable instances if __GLASGOW_HASKELL__ ≤ 707. Is there a particular reason for doing this?

ekmett commented 9 years ago

The manual Typeable instances were because they didn't derive before, IIRC. I have no aversion to deriving clauses when they work.