purescript / purescript-transformers

Monad and comonad transformers
BSD 3-Clause "New" or "Revised" License
69 stars 44 forks source link

Add remaining instances for Comonad transformers #145

Closed skeate closed 3 months ago

skeate commented 1 year ago

Description of the change

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

Closes #35


Checklist:

JordanMartinez commented 1 year ago

:ping_pong: @garyb

garyb commented 1 year ago

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? :wink:

garyb commented 1 year ago

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. :smile:

MonoidMusician commented 1 year ago

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

MonoidMusician commented 1 year ago

Are we good to merge this btw?