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

SafeCopy instance of a parameterized type #29

Open
ddssff opened this issue Jun 23, 2015 · 7 comments
Open

SafeCopy instance of a parameterized type #29

ddssff opened this issue Jun 23, 2015 · 7 comments

Comments

@ddssff
Copy link
Collaborator

ddssff commented Jun 23, 2015

There are circumstances where more context is needed on the type parameter when generating a SafeCopy instance from T1 typ. For example, http://lpaste.net/135048 is a module where the IxSet types create a need for Data, Typeable, and Ord. I'm not yet sure what the correct solution is to this issue, but for the moment I've added these superclasses to our version of safecopy.

@ddssff
Copy link
Collaborator Author

ddssff commented Jun 23, 2015

The error messages I get from that module look like this:

Bug.hs:41:49:
    Could not deduce (Typeable typ) arising from a use of ‘getSafePut’
    from the context (SafeCopy typ)
      bound by the instance declaration
      at Bug.hs:(32,10)-(39,31)
    In a stmt of a 'do' block: safePut_IxSetT1typtyp <- getSafePut
    In the second argument of ‘($)’, namely
      ‘do { safePut_IxSetT1typtyp <- getSafePut;
            safePut_IxSetT1typtyp arg;
            return () }’
    In the expression:
      contain
      $ do { safePut_IxSetT1typtyp <- getSafePut;
             safePut_IxSetT1typtyp arg;
             return () }

@ddssff
Copy link
Collaborator Author

ddssff commented Jun 23, 2015

I just noticed that the context of the data declaration is added to the SafeCopy declaration, so you can fix this by adding context to T2. However, the DatatypeContexts feature is considered a bad thing.

@ddssff
Copy link
Collaborator Author

ddssff commented Jun 24, 2015

I'm closing this because I'm no longer certain the DatatypeContexts directive is necessary.

@ddssff ddssff closed this as completed Jun 24, 2015
@ddssff
Copy link
Collaborator Author

ddssff commented Jun 24, 2015

Ok, I've updated the example http://lpaste.net/135048 to show that it does require DatatypeContexts to build. Reopening.

@ddssff ddssff reopened this Jun 24, 2015
ddssff added a commit to seereason/happstack-scaffolding that referenced this issue Jun 24, 2015
@ddssff
Copy link
Collaborator Author

ddssff commented Dec 4, 2015

This is now fixed.

@ddssff ddssff closed this as completed Dec 4, 2015
@ddssff
Copy link
Collaborator Author

ddssff commented Dec 4, 2015

No, its not.

@ddssff ddssff reopened this Dec 4, 2015
@ddssff
Copy link
Collaborator Author

ddssff commented Dec 5, 2015

http://lpaste.net/146499 is a file that demonstrates the issue.

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

No branches or pull requests

1 participant