Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typeable instance for Keys? #352

Open
agrafix opened this issue Jan 14, 2015 · 3 comments
Open

Typeable instance for Keys? #352

agrafix opened this issue Jan 14, 2015 · 3 comments

Comments

@agrafix
Copy link

agrafix commented Jan 14, 2015

Would it be possible to generate a Typeable/Data instance for Database-Keys?

@snoyberg
Copy link
Member

I just tried this out... looks like we can't derive Typeable for BackendKey SqlBackend. For the generated keys, you can currently use StandaloneDeriving to make this work I think. I'm hesitant to make this a default, as it can break existing programs that don't have DeriveDataTypeable turned on in their code.

@agrafix
Copy link
Author

agrafix commented Jan 15, 2015

Maybe for the next "bigger" Version bump? :-) I'll try out StandaloneDeriving for now, I think it should work.

@parsonsmatt
Copy link
Collaborator

GHC automagically derives Typeable for everything now, so I'm tempted to close this out. But it also asks for Data. Unfortunately, I don't think we can do that:

persistent-template  > /home/matt/Projects/persistent/persistent-template/test/main.hs:44:1: e
rror:
persistent-template  >      Couldn't match representation of type c (BackendKey SqlBackend)
persistent-template  >                                with that of c (Key Address)
persistent-template  >         arising from the coercion of the method gfoldl
persistent-template  >           from type forall (c :: * -> *).
persistent-template  >                      (forall d b. Data d => c (d -> b) -> d -> c b)
persistent-template  >                      -> (forall g. g -> c g)
persistent-template  >                      -> BackendKey SqlBackend
persistent-template  >                      -> c (BackendKey SqlBackend)
persistent-template  >             to type forall (c :: * -> *).
persistent-template  >                      (forall d b. Data d => c (d -> b) -> d -> c b)
persistent-template  >                      -> (forall g. g -> c g) -> Key Address -> c (Key A
ddress)
persistent-template  >       NB: We cannot know what roles the parameters to c have;
persistent-template  >         we must assume that the role is nominal
persistent-template  >      When deriving the instance for (Data (Key Address))

Perhaps we should drop the BackendKey business.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants