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

Deeper integration with polysemy #121

Closed
chshersh opened this issue May 7, 2019 · 0 comments · Fixed by #165
Closed

Deeper integration with polysemy #121

chshersh opened this issue May 7, 2019 · 0 comments · Fixed by #165
Assignees
Labels
Hacktoberfest https://hacktoberfest.digitalocean.com/ log-action Everything related to LogAction data type package:co-log-polysemy For: co-log-polysemy

Comments

@chshersh
Copy link
Contributor

chshersh commented May 7, 2019

The LogAction data type is defined like this:

https://github.com/kowainik/co-log/blob/746016089a44e06dadf23818044285bd3ab22135/co-log-core/src/Colog/Core/Action.hs#L90-L92

The initial assumption was to make it work with any monad. And nothing stops from specializing the m parameter to the Sem monad from the polysemy package!

Currently we have the following interpreter for the LogAction:

https://github.com/kowainik/co-log/blob/746016089a44e06dadf23818044285bd3ab22135/co-log-polysemy/src/Colog/Polysemy/Effect.hs#L82-L87

This interpreter assumes that that the Sem r monad has an ability to execute monadic effects of type m. However, it seems like it's possible to loose this restriction with the following code:

-- ideas for better names are always appreciated!
type LogActionSem r msg = LogAction (Sem r) msg

runLogActionSem :: LogAction (Sem r) msg -> Sem (Log msg ': r) -> Sem r

So instead of defining LogAction in some arbitrary monad m, you can define LogAction that is capable of using the Sem monad itsefl.

@chshersh chshersh added package:co-log-polysemy For: co-log-polysemy log-action Everything related to LogAction data type labels May 7, 2019
@chshersh chshersh added the Hacktoberfest https://hacktoberfest.digitalocean.com/ label Sep 29, 2019
@chshersh chshersh added this to the v0.4.0.0: Polishtown milestone Nov 8, 2019
@chshersh chshersh self-assigned this Dec 29, 2019
chshersh added a commit that referenced this issue Dec 29, 2019
vrom911 pushed a commit that referenced this issue Dec 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Hacktoberfest https://hacktoberfest.digitalocean.com/ log-action Everything related to LogAction data type package:co-log-polysemy For: co-log-polysemy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant