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

No instances for recently-added monads from transformers #44

Closed
bucklereed opened this issue Jul 24, 2017 · 7 comments
Closed

No instances for recently-added monads from transformers #44

bucklereed opened this issue Jul 24, 2017 · 7 comments

Comments

@bucklereed
Copy link

Control.Monad.Trans.Accum was added in transformers 0.5.3.0, but currently it's slightly painful to use because it doesn't have the usual MonadState, MonadReader, etc instances yet.

Whether it should get a MonadWriter instance that lifts the operations to the inner monad or handles them itself is a question.

SelectT was also added in transformers 0.5.3.0 and similarly lacks instances.

@bucklereed bucklereed changed the title No instances for recently-added monads No instances for recently-added monads from transformers Jul 24, 2017
@RyanGlScott
Copy link
Member

We should definitely add instances for AccumT and SelectT.

As far as how AccumT's instances should work, I'm not sure. @fizruk had proposed in #32 that we introduce a new type class for things that can support AccumT's operations (MonadAccum?), but it's not clear to me what its relationship with MonadWriter/MonadState would be.

I think there are enough design questions here that it would be beneficial to draft up a sketch of how this would work and propose it to the Haskell libraries mailing list for feedback.

@fizruk
Copy link

fizruk commented Jul 25, 2017

I think that AccumT should propagate MonadReader, MonadWriter and MonadState to inner monad and that we should introduce MonadAccum. This would be consistent with how other classes and transformers work.

@RyanGlScott
Copy link
Member

@fizruk, that sounds reasonable to me. But the design of these Monad- classes are usually more involved than one would initially believe (at least in my experience), so I think it would help to come up with a concrete design and propose it to the mailing list. If the community likes it, I'll accept a PR which implements it.

@ekmett
Copy link
Member

ekmett commented Sep 28, 2017

I'm also leaning towards adding MonadAccum and the like.

@treeowl
Copy link

treeowl commented Dec 5, 2017

I just got bitten by the lack of a MonadError instance for AccumT.

@minad
Copy link

minad commented Nov 23, 2018

See also #38

@chessai
Copy link
Member

chessai commented Jul 16, 2021

This is resolved in master, pending 2.3 release

@chessai chessai closed this as completed Jul 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants