-
Notifications
You must be signed in to change notification settings - Fork 63
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 MonadAccum #89
Add MonadAccum #89
Conversation
This looks good, but it needs a changelog entry |
050fb31
to
64b79da
Compare
Weird, CI is not triggered... |
I think our travis credits ran out. I am preparing a PR to switch to GitHub actions. |
Can you rebase on top of master to get CI changes? |
2107849
to
c3eded6
Compare
Done :) I think it's waiting for you to trigger the CI. |
I'm expecting some older versions to fail, but I think it's easier to test that on CI than to install all the old versions of GHC. |
I have triggered CI. |
51b21a9
to
b1b2cfe
Compare
Getting the CPP right is really painful. Is there a good trick to run the whole CI locally somehow? Possibly using nix? |
-- Advanced School of Functional Programming, 1995. | ||
----------------------------------------------------------------------------- | ||
|
||
module Control.Monad.Accum ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of re-exporting the modules, we need the haddocks to look like others. In order to do that, we need three sections:
- MonadAccum class
- The Accum monad
- The AccumT monad transformer
Please refer to eg the documentation for Control.Monad.Reader
Does |
I thought about some laws, also see this discussion if you're interested: fused-effects/fused-effects#391 (comment) It's not clear to me how to generalise them optimally to
|
Thank you for putting this patch together. I don't have any problem with the code, but I'm not really sold on adding Where did |
I've used it myself in a few places in the past, even in production. Some reasons why it's not so common as other transformers might be:
The second one is kind of a self-fulfilling prophecy.
Typical use cases for me are counters, or handing out unique keys/ids/tokens. I wasn't familiar with update monads, so not sure how those relate. To me it seems that Should
So if |
-- | ||
-- The MonadAccum class. | ||
-- | ||
-- Inspired by the paper |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should remove this section given this transformer is not inspired by that paper. Some similar modules don't have this disclaimer in them, such as Control.Monad.Identity
.
Superceded by #109 |
See #86