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 Lens' to the HasLog typeclass #101

Closed
chshersh opened this issue May 2, 2019 · 0 comments · Fixed by #105
Closed

Add Lens' to the HasLog typeclass #101

chshersh opened this issue May 2, 2019 · 0 comments · Fixed by #105
Assignees
Labels
enhancement New feature or request package:co-log-core For: co-log-core

Comments

@chshersh
Copy link
Contributor

chshersh commented May 2, 2019

The HasLog typeclass has all functions required for implementing custom lens. Since lenses are reusable, because they are just type alias, I propose to add the following field to the HasLog typeclass with the default definition:

logActionL :: Lens' env (LogAction m msg)
logActionL = ...

So we need to introduce our own Lens' type alias (and reexport it) and add logActionL lens to the HasLog typeclass with the default definition (so people can implement their own definition if they want.

With this approach we won't depend on any *lens* package but still will provide lens-like interface using ideas from the following blog post:

@chshersh chshersh added enhancement New feature or request package:co-log-core For: co-log-core labels May 2, 2019
vrom911 added a commit that referenced this issue May 3, 2019
vrom911 added a commit that referenced this issue May 3, 2019
chshersh pushed a commit that referenced this issue May 3, 2019
* [#101] Add logActionL lens, impove docs a bit

Resolves #101

* Update co-log-core/src/Colog/Core/Class.hs

Co-Authored-By: vrom911 <vrom911@gmail.com>

* Fix after review

* Fix hlint redundant lambda
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request package:co-log-core For: co-log-core
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants