-
Notifications
You must be signed in to change notification settings - Fork 17
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
No lens support #10
Comments
That's a good question. I mention the idea briefly in the second-to-last paragraph of the blog post I just wrote about this. The primary reason is that I still don't know how to deal neatly with deletion if we were to use lenses. Deleting could be modifying with The secondary reason is that this seemed slightly easier to code, and the approaches aren't (EDIT: was originally 'are') mutually exclusive, so I thought I'd do this first. Happy to add lens support, though. Maybe this issue should be the place for discussing adding it. |
You mean a lens |
Basically! Whether |
If it's Void, how would you ever delete a value? You'd need to apply over the lens some |
Except bottom :). But if that sounds bad - sure, then |
Why not tell the user that all the fields already implicitly exist with a value of type ()? It's basically equivalent to non. (In fact maybe you can even use |
That's an option, but then you still have to make sure that e.g. As for |
And then we add https://hackage.haskell.org/package/indexed-extras-0.2/docs/Control-Monad-Indexed-State.html and define a variant on %= which has type
and then you can throw other state actions behind that into the same do block. |
That is beautiful :) |
This looks amazing - I'd second the notion that having lenses work out of the box with it would be awesome! |
record
uses lenses because, as he notes, they already solve the modification part of the record problem. Why don't you?The text was updated successfully, but these errors were encountered: