
You can't automatically derive Typeable for any type with a kind that
has any arguments that aren't of type *.
For instance, you can derive an instance for a type with a kind *, *
-> *, or even * -> * -> * -> * -> * -> *, but not one with a kind (*
-> *) -> *.
And your type A there has kind (* -> *) -> *. You'll have to manually
write a Typeable instance if you want one. The process is somewhat
trickier than you might expect, due to the fact that Typeable does
some unsafe stuff. But there are plenty of examples for how to do it
safely.
Enjoy the fun of not having kind polymorphism!
Carl Howells
On Fri, Sep 24, 2010 at 1:18 PM, Christopher Done
Suppose I have a data type:
data A f = A { a :: f Integer }
why can't I derive a Typeable instance like so?
deriving instance Typeable (A Maybe)
I get:
Can't make a derived instance of `Typeable (A Maybe)': `A' has arguments of kind other than `*' In the stand-alone deriving instance for `Typeable (A Maybe)'
I would have expected that the arguments are instantiated by the Maybe type constructor and thus the type of A would be:
Maybe Integer -> A
What am I missing? _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe