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

MonadAccum #109

Merged
merged 7 commits into from
May 6, 2022
Merged

MonadAccum #109

merged 7 commits into from
May 6, 2022

Conversation

kozross
Copy link
Collaborator

@kozross kozross commented May 2, 2022

This defines a type class, along with a helper DerivingVia type, a bunch of instances, documentation and laws, to address the corresponding entry in #86.

This is WIP for now, as I want to add some details about the meaning of the various instances, which may not be 100% obvious to a first-time reader.

@kozross kozross requested review from chessai and emilypi May 2, 2022 04:39
Copy link
Member

@emilypi emilypi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WIP, needs some expanded docs, but otherwise LGTM

--
-- [Zero and plus:] None.
--
-- [Example type:] @'Accum' w a@
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually kind of like this doc style. 👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't claim any credit here. I'm just using what already existed for (at least) MonadCont.

-- 1. @'accum' ('const' (x, 'mempty'))@ @=@ @'pure' x@
-- 2. @'accum' f '*>' 'accum' g@ @=@
-- @'accum' '$' \acc -> let (_, v) = f acc
-- (res, w) = g (acc '<>' v) in (res, v '<>' w)@
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would name these laws:

  1. [Pure-Quot] (in the sense of pure x being quotiented with (x, mempty))
  2. [Const-Accum] because it is what it says it is.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'd need to name all the others too, then. Good idea though.

@turion
Copy link

turion commented May 2, 2022

I guess you're aware of #89, on which I took a break because I didn't quite get how the docs were supposed to be structured.

@turion
Copy link

turion commented May 2, 2022

And, I should add, I can finish #89 if that saves you work & brain capacity.

@kozross
Copy link
Collaborator Author

kozross commented May 2, 2022

@turion At this point I'm nearly done anyway - I just have some docs to add and that's it. But thanks for offering!

@emilypi
Copy link
Member

emilypi commented May 3, 2022

@kozross we should add @turion as a coauthor on the squash/rebased commit to master just to acknowledge their additions. We (chessai and myself) let their PR languish, and that's why it didn't go in.

@kozross
Copy link
Collaborator Author

kozross commented May 3, 2022

@emilypi My work is clean-room, though I'm happy to add @turion into the list of authors.

@kozross kozross marked this pull request as ready for review May 4, 2022 03:55
@kozross
Copy link
Collaborator Author

kozross commented May 4, 2022

@emilypi and @chessai - I wrote the docs I wanted, and addressed all the things needing addressing. I couldn't do a proper description of what the SelectT stack does, but that's because I don't even know what SelectT does in general, as @emilypi is aware.

@kozross kozross merged commit 9255a03 into master May 6, 2022
@kozross kozross mentioned this pull request May 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants