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

Feature request: Lenses generation without type signatures #65

Closed
supki opened this issue Oct 1, 2012 · 4 comments
Closed

Feature request: Lenses generation without type signatures #65

supki opened this issue Oct 1, 2012 · 4 comments

Comments

@supki
Copy link
Collaborator

supki commented Oct 1, 2012

In the following code snippet it would be convenient to generate lenses without explicit type signatures for the purpose of documentation:

data A = A { _a  Int, _b  Int }

makeLensesNoTypeSignatures ''A

So we can have nice haddocks:

-- | Lens 'a'
a  Lens A A Int Int

-- | Lens 'b'
b  Lens A A Int Int
@mgsloan
Copy link
Collaborator

mgsloan commented Oct 1, 2012

I like this idea! We were recently lamenting the fact that TH can't
generate haddocks. We could probably have some sort of half decent
generated docs (maybe even describing why the lens is polymorphic in the
fashion that it is!)

It also ensures that the code generator doesn't unexpectedly change its
behavior and output something with an incompatible type (not something we
anticipate happening, but could happen).

On Mon, Oct 1, 2012 at 1:35 PM, Matvey B. Aksenov <notifications@github.com

wrote:

In the following code snippet it would be convenient to generate lenses
without explicit type signatures for the purpose of documentation:

data A = A { _a ∷ Int, _b ∷ Int }
makeLensesNoTypeSignatures ''A

So we can have nice haddocks:

-- | Lens 'a'a ∷ Lens A A Int Int
-- | Lens 'b'b ∷ Lens A A Int Int


Reply to this email directly or view it on GitHubhttps://github.com//issues/65.

@ekmett
Copy link
Owner

ekmett commented Oct 2, 2012

I recall you (or someone else) asking for this on the Haskell channel, but I forgot to make an issue.

I definitely have no problem with adding this.

It is a clean solution to a messy problem.

@supki
Copy link
Collaborator Author

supki commented Oct 2, 2012

Yes, it was me on #haskell
Thanks, guys.

@ekmett
Copy link
Owner

ekmett commented Oct 3, 2012

With 3.0.2, you should now be able to do:

makeLensesWith (lensRules % generateSignatures .~ False) ''A

@ekmett ekmett closed this as completed Oct 3, 2012
@ghost ghost assigned ekmett Oct 3, 2012
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

3 participants