haskell / mtl

The Monad Transformer Library
http://www.haskell.org/haskellwiki/Monad_Transformers
Other
362 stars 63 forks source link

No instances for recently-added monads from transformers #44

Closed bucklereed closed 3 years ago

bucklereed commented 7 years ago

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.

RyanGlScott commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

@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 commented 6 years ago

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

treeowl commented 6 years ago

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

minad commented 5 years ago

See also #38

chessai commented 3 years ago

This is resolved in master, pending 2.3 release