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

Add remaining instances for Comonad transformers #145

Merged
merged 1 commit into from
Jun 26, 2024

Conversation

skeate
Copy link
Contributor

@skeate skeate commented Oct 13, 2022

Description of the change

Adds ComonadAsk, ComonadEnv, and ComonadTraced instances for StoreT, EnvT, and TracedT

Closes #35


Checklist:

  • Added the change to the changelog's "Unreleased" section with a reference to this PR (e.g. "- Made a change (#0000)")
  • Linked any existing issues or proposals that this pull request should close
  • Updated or added relevant documentation
  • Added a test for the contribution (if applicable)

@JordanMartinez
Copy link
Contributor

🏓 @garyb

@garyb
Copy link
Member

garyb commented Oct 17, 2022

I did take a look at this, but I don't feel qualified to approve it, since I'm not that familiar with comonad patterns. Perhaps @MonoidMusician or @LiamGoodacre could chime in, I think they're more theorypilled than me? 😉

Copy link

@MonoidMusician MonoidMusician left a comment

Choose a reason for hiding this comment

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

Yup, looks good to me! It’s doing the “obvious” thing, which is just the opposite of the usual monadic constructions.

@garyb
Copy link
Member

garyb commented Oct 18, 2022

Yup, looks good to me! It’s doing the “obvious” thing, which is just the opposite of the usual monadic constructions.

Ah okay. I did once implement some comonad stuff and it seemed way too trivial to be correct. I asked someone and they weren't sure if it was right either. 😄

@MonoidMusician
Copy link

Yeah, this is just lifting instances like ask = lift <<< ask in the monadic work, but it's ask = ask <<< lower here :)

@MonoidMusician
Copy link

Are we good to merge this btw?

Comment on lines +55 to +63
lowerTrack :: forall t m w a. ComonadTrans t => ComonadTraced m w => m -> t w a -> a
lowerTrack m = track m <<< lower
Copy link
Member

Choose a reason for hiding this comment

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

is this an implementation detail, or something to be exported? (It's currently being implicitly exported).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

whoops, yeah this should not be exported

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.

Add remaining Comonad* instances
6 participants