Skip to content

Alternative instances no longer require MonadPlus#106

Open
GregoryTravis wants to merge 6 commits intohaskell:mainfrom
GregoryTravis:alternative
Open

Alternative instances no longer require MonadPlus#106
GregoryTravis wants to merge 6 commits intohaskell:mainfrom
GregoryTravis:alternative

Conversation

@GregoryTravis
Copy link

@GregoryTravis GregoryTravis commented Feb 7, 2026

Fixes #83 by requiring Alternative rather than MonadPlus in the Alternative instances for:

  • Accum
  • RWS/CPS
  • RWS/Lazy
  • RWS/Strict
  • Select
  • State/Lazy
  • State/Strict
  • Writer/CPS


instance (Functor m, MonadPlus m) => Alternative (RWST r w s m) where
empty = RWST $ \ _ _ _ -> mzero
instance (Functor m, Alternative m, Monad m) => Alternative (RWST r w s m) where
Copy link
Collaborator

Choose a reason for hiding this comment

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

There are some redundant constraints here.

Copy link
Author

Choose a reason for hiding this comment

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

I removed Functor here; Monad seems to need to stay because of the do block in Applicative RWST.

@GregoryTravis GregoryTravis requested a review from sjshuck February 7, 2026 20:52
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.

Why Alternative instances require MonadPlus?

2 participants