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

WithSeverity #13

Closed
michaelpj opened this issue Jan 30, 2022 · 2 comments · Fixed by #14
Closed

WithSeverity #13

michaelpj opened this issue Jan 30, 2022 · 2 comments · Fixed by #14
Labels
enhancement New feature or request

Comments

@michaelpj
Copy link
Collaborator

I find myself wanting this type:

data WithSeverity a = WithSeverity a Severity

i.e. a message tagged with a severity. Then I can do something like this

data Log1 = ...
data Log2 = ALog1 Log1 | ...

adapt :: LogAction m (WithSeverity Log2) -> LogAction m (WithSeverity Log1)
adapt = cmap (fmap ALog1)

Given that co-log-core provides Severity, perhaps it would be nice to provide WithSeverity also?

@chshersh chshersh added the enhancement New feature or request label Jan 31, 2022
@chshersh
Copy link
Contributor

This sounds like a good idea 🙂

It looks useful to have such WithSeverity data type in the Colog.Core.Severity module. Feel free to open a PR, adding your use case as an example in documentation! 👍🏻

@michaelpj
Copy link
Collaborator Author

Okay, I'll make a PR.

michaelpj added a commit to michaelpj/co-log-core that referenced this issue Jan 31, 2022
chshersh pushed a commit that referenced this issue Feb 1, 2022
* Add WithSeverity

Fixes #13.

* Add mapSeverity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants