co-log/co-log-core

`WithSeverity`

michaelpj opened this issue · 2 comments

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?

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! 👍🏻

Okay, I'll make a PR.