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

Lens products #28

Open
cfhammill opened this issue Oct 18, 2018 · 1 comment
Open

Lens products #28

cfhammill opened this issue Oct 18, 2018 · 1 comment

Comments

@cfhammill
Copy link
Owner

From Control.Lens.Unsound


lensProduct :: ALens' s a -> ALens' s b -> Lens' s (a, b)

A lens product. There is no law-abiding way to do this in general. Result is only a valid Lens if the input lenses project disjoint parts of the structure s. Otherwise "you get what you put in" law

view l (set l v s) ≡ v

is violated by

>>> let badLens :: Lens' (Int, Char) (Int, Int); badLens = lensProduct _1 _1
>>> view badLens (set badLens (1,2) (3,'x'))
(2,2)

but we should get (1,2).

Are you looking for alongside?


The answer is yes, we are probably looking for alongside.

@cfhammill
Copy link
Owner Author

I have casually accepted too much pain instead of just writing alongside

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

1 participant