Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,326
    • Issues 4,326
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 390
    • Merge Requests 390
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #14960

Closed
Open
Opened Mar 21, 2018 by lyxia@trac-lyxia

Invalid law for MonadPlus: v >> mzero = mzero

The documentation of MonadPlus states: v >> mzero = mzero. This law is broken by IO, MaybeT, and a few other monads with some notion of "irreversible effects". I propose to just remove that law.

https://hackage.haskell.org/package/base-4.11.0.0/docs/Control-Monad.html\#t:MonadPlus

Another alternative is to keep it but remove unlawful instances, so MonadPlus instances can signal that those laws hold, on top of the Alternative instances. But that breaks backwards compatibility, because MonadPlus for IO and MaybeT is already used in many places.

This thread previously brought up the issue but hasn't been followed up: https://mail.haskell.org/pipermail/libraries/2014-January/021993.html, continued on https://mail.haskell.org/pipermail/libraries/2014-February/022004.html with some interesting discussion about what those laws should be.

This even older thread also discusses MonadPlus laws, hence it also seems relevant to improve the documentation: https://mail.haskell.org/pipermail/haskell-cafe/2005-January/008751.html.

Trac metadata
Trac field Value
Version 8.2.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component libraries/base
Test case
Differential revisions
BlockedBy
Related
Blocking
CC lyxia
Operating system
Architecture
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#14960