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

Make lenses with template Haskell #68

Merged
merged 4 commits into from Jul 30, 2014
Merged

Make lenses with template Haskell #68

merged 4 commits into from Jul 30, 2014

Conversation

tfausak
Copy link
Owner

@tfausak tfausak commented Jul 30, 2014

Fixes #50.

This is an extremely rough attempt. Short list of problems:

-   makeLenses is gross. In fact, Strive.Internal.TH is some of the
    grossest Haskell I've written. But it's at the limit of my
    knowledge. I should learn how to make it better (with quasi
    quotation, probably).

-   Listing all the things to make lenses for feels silly. There's got
    to be a way to use `map` (or something) to do that. Even so, it
    would be a lot better if I could pass an entire *module* (like
    `Strive.Types`) in and have it find all the types defined within.
@tfausak tfausak self-assigned this Jul 30, 2014
@tfausak
Copy link
Owner Author

tfausak commented Jul 30, 2014

I'm not sure if the lens class names should be hygenic or not. They're currently unhygenic, like IdLens. If I made them with newName instead of mkName, they'd be like IdLens_a123. Ultimately I don't think it matters much, which is why I went with the simpler option.

@tfausak
Copy link
Owner Author

tfausak commented Jul 30, 2014

This pull request runs afoul of b632b95 since it doesn't explicitly list exports. I think it might be better to leave Strive.Lenses alone and put all this template Haskell stuff in something like Strive.Internal.Lenses.

@tfausak tfausak merged commit f3f0d16 into master Jul 30, 2014
@tfausak tfausak deleted the issue-50 branch July 31, 2014 00:32
@tfausak tfausak mentioned this pull request Jul 31, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use template Haskell to generate lenses
1 participant