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

Make Message data type more flexible #103

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

Make Message data type more flexible #103

chshersh opened this issue May 2, 2019 · 0 comments · Fixed by #104
Assignees

Comments

@chshersh
Copy link
Contributor

chshersh commented May 2, 2019

Required for #97.

Current structure of the Message data type:

data Message = Message
    { messageSeverity :: !Severity
    , messageStack    :: !CallStack
    , messageText     :: !Text
    }

log :: WithLog env Message m => Severity -> Text -> m ()

Proposed change:

data Msg sev = Msg
    { msgSeverity :: !sev
    , msgStack    :: !CallStack
    , msgText     :: !Text
    }

type Message = Msg Severity

log :: WithLog env (Msg sev) m => sev -> Text -> m ()

Few explanations:

  1. Message data type now stores polymorphic severities, so user are able to use their own severities.
  2. Message data type is renamed to Msg and Message is converted to the type Message alias for better backwards compatibility.
@chshersh chshersh self-assigned this May 2, 2019
chshersh pushed a commit that referenced this issue May 3, 2019
vrom911 pushed a commit that referenced this issue May 3, 2019
* [#103] Make Message polymorphic, improve docs

Resolves #103

* Make HLint happy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant