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 a strict over? #1016

Open
treeowl opened this issue Dec 20, 2022 · 1 comment · May be fixed by #1017
Open

Add a strict over? #1016

treeowl opened this issue Dec 20, 2022 · 1 comment · May be fixed by #1017

Comments

@treeowl
Copy link
Contributor

treeowl commented Dec 20, 2022

I don't see a strict version of over, which we could put in Control.Lens.Traversal.

over' :: ATraversal s t a b -> (a -> b) -> s -> t
over' l f = getSolo . cloneTraversal l (\old -> Solo $! f old)
  where
    getSolo (Solo x) = x

I don't remember how indexed stuff works, but I'm sure that's available too.

@treeowl treeowl changed the title And a strict over? Add a strict over? Dec 20, 2022
@treeowl
Copy link
Contributor Author

treeowl commented Dec 20, 2022

@phadej points out that this could alternatively take a LensLike Solo. I have no idea how to choose between that and ATraversal.

treeowl added a commit to treeowl/lens that referenced this issue Dec 21, 2022
Add `over'` and `iover'`, which force the result(s) of applying
the passed function.

Closes ekmett#1016
@treeowl treeowl linked a pull request Dec 21, 2022 that will close this issue
treeowl added a commit to treeowl/lens that referenced this issue Dec 27, 2022
* Add `strictly` to turn a lazy (standard) traversal into a strict one
  that forces targets before installing them.
* Add `over'`, `iover'`, `modifying'`, `imodifying'`, and corresponding
  operators `%!~`, `%!@~`, `%!=`, and `%!@=`.
* Adjust documentation.

Closes ekmett#1016
treeowl added a commit to treeowl/lens that referenced this issue Dec 28, 2022
* Add `strictly` to turn a lazy (standard) traversal into a strict one
  that forces targets before installing them.
* Add `over'`, `iover'`, `modifying'`, `imodifying'`, and corresponding
  operators `%!~`, `%!@~`, `%!=`, and `%!@=`.
* Adjust documentation.

Closes ekmett#1016
treeowl added a commit to treeowl/lens that referenced this issue Dec 28, 2022
* Add `strictly` to turn a lazy (standard) traversal into a strict one
  that forces targets before installing them.
* Add `over'`, `iover'`, `modifying'`, `imodifying'`, and corresponding
  operators `%!~`, `%!@~`, `%!=`, and `%!@=`.
* Adjust documentation.

Closes ekmett#1016
treeowl added a commit to treeowl/lens that referenced this issue Dec 28, 2022
* Add `strictly` to turn a lazy (standard) traversal into a strict one
  that forces targets before installing them.
* Add `over'`, `iover'`, `modifying'`, `imodifying'`, and corresponding
  operators `%!~`, `%!@~`, `%!=`, and `%!@=`.
* Adjust documentation.

Closes ekmett#1016
treeowl added a commit to treeowl/lens that referenced this issue Dec 28, 2022
* Add `strictly` to turn a lazy (standard) traversal into a strict one
  that forces targets before installing them.
* Add `over'`, `iover'`, `modifying'`, `imodifying'`, and corresponding
  operators `%!~`, `%!@~`, `%!=`, and `%!@=`.
* Adjust documentation.

Closes ekmett#1016
treeowl added a commit to treeowl/lens that referenced this issue Dec 28, 2022
* Add `strictly` to turn a lazy (standard) traversal into a strict one
  that forces targets before installing them.
* Add `over'`, `iover'`, `modifying'`, `imodifying'`, and corresponding
  operators `%!~`, `%!@~`, `%!=`, and `%!@=`.
* Adjust documentation.

Closes ekmett#1016
treeowl added a commit to treeowl/lens that referenced this issue Dec 28, 2022
* Add `strictly` to turn a lazy (standard) traversal into a strict one
  that forces targets before installing them.
* Add `over'`, `iover'`, `modifying'`, `imodifying'`, and corresponding
  operators `%!~`, `%!@~`, `%!=`, and `%!@=`.
* Adjust documentation.

Closes ekmett#1016
treeowl added a commit to treeowl/lens that referenced this issue Dec 28, 2022
* Add `strictly` to turn a lazy (standard) traversal into a strict one
  that forces targets before installing them.
* Add `over'`, `iover'`, `modifying'`, `imodifying'`, and corresponding
  operators `%!~`, `%!@~`, `%!=`, and `%!@=`.
* Adjust documentation.

Closes ekmett#1016
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 a pull request may close this issue.

1 participant