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

Add more FieldX instances for tuples #145

Open
worm2fed opened this issue May 10, 2021 · 3 comments
Open

Add more FieldX instances for tuples #145

worm2fed opened this issue May 10, 2021 · 3 comments

Comments

@worm2fed
Copy link

Why this instances is commented?
https://github.com/monadfix/microlens/blob/effacc20f861de1a05a04a5b697dcb8690b80521/microlens/src/Lens/Micro/Internal.hs#L423-L441

In package description there are:

This library is an extract from lens (with no dependencies). It's not a toy lenses library, unsuitable for “real world”, but merely a small one. It is compatible with lens, and should have same performance. It also has better documentation.

With this lines commented we receive version of _1 not really equivalent with same in lens

Is there any reason for it or it was just missed for some reasons?

@neongreen
Copy link
Collaborator

They probably increased the compilation time beyond our 4s target, though I'm not sure. I can reenable them if you have a usecase for them.

@worm2fed
Copy link
Author

We have our Prelude which uses micro-lens and re-exports some it's functions.
And we have our project which uses lenses (because micro doesn't allow to make this:

content = mempty
  & at "multipart/form-data" ?~ mempty & schema ?~ paramSchema

out of the box) -> so we switched to lens

And we also have type which needs instance for 7-tuple.
For now we have same instance as commented here in Orphans, and it's not a big deal. We ok with it.
But it's strange, that there are solution already, but it can't be used by others.

How do you think, is it really significantly increases compilation time?

@neongreen
Copy link
Collaborator

For what it's worth, I think for apps you should use lens or optics anyway, not microlens.

We have 5*4/2 = 10 instances for _1 _2 _3 _4 _5. If I add instances up to _9, it will be 9*8/2 = 36 instances, a significant increase. Currently microlens builds in 6.5s; if I add the instances, it builds in about 6.9–8.2s.

So for now I will avoid adding the instances. If anybody else wants them — please chime in!

@neongreen neongreen changed the title Commented instances Add more FieldX instances for tuples May 10, 2021
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

2 participants