deriving Typeable
Simon Peyton-Jones
simonpj at microsoft.com
Thu Jun 3 03:27:05 EDT 2004
You can just write the instance of Typeable by hand
instance Typeable1 e => Typeable (Y e) where ...
(Use the instances in the library as a guide.)
Yes, GHC could do this for you, but it would then stumble when e had kind ((*->*) -> *). We need kind polymorphism!
Simon
| -----Original Message-----
| From: glasgow-haskell-users-bounces at haskell.org [mailto:glasgow-haskell-users-
| bounces at haskell.org] On Behalf Of John Meacham
| Sent: 02 June 2004 21:53
| To: glasgow-haskell-users at haskell.org
| Subject: deriving Typeable
|
| newtype Y e = Y { unY :: (e (Y e)) }
| deriving(Data,Typeable,Show,Read,Eq)
|
| gives
| E.hs:64:
| Can't make a derived instance of `Typeable (Y e)'
| (`Y' is parameterised over arguments of kind other than `*')
| When deriving instances for type `Y'
|
| Is there any way around this limitation other than manually expanding Y
| everywhere I want to use it (which I really don't want to do)? Is the
| limitation inherent to the way Typeable works, or is it just that no one
| has implemented it yet?
|
| --
| John Meacham - ⑆repetae.net⑆john⑈
| _______________________________________________
| Glasgow-haskell-users mailing list
| Glasgow-haskell-users at haskell.org
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
More information about the Glasgow-haskell-users
mailing list