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

[#290] Add Universum.Lens module #291

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Sorokin-Anton
Copy link
Contributor

@Sorokin-Anton Sorokin-Anton commented Sep 11, 2023

Description

Problem:
As in #290, we want to export lens-related operators like (^.) or (^?), but we don't want to depend on microlens or lens.

Solution:
Implement those operators by ourselves, and export them in a separate module to avoid name conflicts.
Remove those operators from Universum reexports.

Related issues(s)

Fixed #290

✓ Checklist for your Pull Request

Ideally a PR has all of the checkmarks set.

If something in this list is irrelevant to your PR, you should still set this
checkmark indicating that you are sure it is dealt with (be that by irrelevance).

  • I made sure my PR addresses a single concern, or multiple concerns which
    are inextricably linked. Otherwise I should open multiple PR's.
  • If I added/removed/deprecated functions/re-exports,
    I checked whether these changes impact the .hlint.yaml rules
    and updated them if needed.

Related changes (conditional)

  • Tests

    • If I added new functionality, I added tests covering it.
    • If I fixed a bug, I added a regression test to prevent the bug from
      silently reappearing again.
  • Documentation

    I checked whether I should update the docs and did so if necessary:

  • Record your changes

    • I added an entry to the changelog (creating the Unreleased section if necessary) if my changes are visible to the users
      and
    • provided a migration guide for breaking changes if possible

Stylistic guide (mandatory)

  • My commit history is clean (only contains changes relating to my
    issue/pull request and no reverted-my-earlier-commit changes) and commit
    messages start with identifiers of related issues in square brackets.

    Example: [#42] Short commit description

    If necessary both of these can be achieved even after the commits have been
    made/pushed using rebase and squash.

✓ Release Checklist

  • I updated the version number in universum.cabal.
  • I updated the changelog and moved everything
    under the "Unreleased" section to a new section for this release version.
  • If any definitions (functions, type classes, instances, etc) were added,
    I added @since haddock annotations.
  • (After merging) I created a new entry in the releases page,
    with a summary of all user-facing changes.
    • I made sure a tag was created using the format vX.Y.Z

Problem:
As in #290, we want to export lens-related operators
like `(^.)` or `(^?)`, but we don't want to depend on
`microlens` or `lens`.

Solution:
Implement those operators by ourselves, export them in
a separate module to avoid names conflict.

Remove those operators from `Universum` reexports.
@Sorokin-Anton Sorokin-Anton self-assigned this Sep 11, 2023
Copy link
Member

@gromakovsky gromakovsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. It looks like you partially deleted deprecated stuff. I propose to delete all deprecated microlens stuff in this PR (ideally in a separate commit). AFAIU you deleted it because otherwise Universum.Lens is unusable (it conflicts with Universum itself). So we can't add Universum.Lens without deleting some deprecated things, so we can't put it into 1.8.x release. So we'll need to put it into 1.9.0, and it would be strange to make 1.9.0 without deleting all microlens things.
  2. Since everything in Universum.Lens is now defined manually, I think tests are needed.
  3. Also the changelog should be updated.

@Sorokin-Anton
Copy link
Contributor Author

@gromakovsky

  1. It looks like you partially deleted deprecated stuff. I propose to delete all deprecated microlens stuff in this PR

Do we want to have _1, _2, etc in Universum.Lens? I like it and looks like we can just copy-paste the Field1 and other typeclasses.

What about microlens-mtl? I suggest just stopping exporting them, but maybe we still want them?

  1. Since everything in Universum.Lens is now defined manually, I think tests are needed.

Ok will add this week

@gromakovsky
Copy link
Member

Do we want to have _1, _2, etc in Universum.Lens? I like it and looks like we can just copy-paste the Field1 and other typeclasses.

AFAIU they won't be compatible with functions from lens or microlens, because they define their own Field1 and other classes. Also they seem to be less trivial and more cumbersome. I'd like to avoid excessive copy-paste and to keep Universum.Lens small, because the whole universum should be relatively lightweight (since it's just a prelude).

But my main point was that currently the code in this branch hardly makes sense: the main point of adding Universum.Lens is to have some lens-related definitions without any extra dependencies, but microlens remains a dependency. So I think all microlens stuff should be deleted prior to adding Universum.Lens. Also you deleted mentions of microlens from README, but it's still used.

@Sorokin-Anton
Copy link
Contributor Author

Yes I was going to delete them after we'd agree to do so. Let's keep the current exports from Universum.Lens (no microlens-mtl, no lens for tuples). I'll do this, add tests and fix docs where needed soon

@Sorokin-Anton
Copy link
Contributor Author

I should not change any version tags, right? We must be sure no 1.8.x release will happen after we merge this to master

@gromakovsky
Copy link
Member

Yep, don't change the version, but please write about this change in CHANGES.md. The person making the next release is supposed to read the changelog and realize that the change you made here is a breaking one. You may also provide a Migration guide to make it clearer (the migration is to use either lens or microlens as a dependency).

@Martoon-00 Martoon-00 self-requested a review October 20, 2023 13:28
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

Successfully merging this pull request may close these issues.

Export most-used lens-related operators in a separate module
2 participants