The standard class hierarchy is a consequence of Haskell's historical development, rather than logic. I would therefore like to propose a reform of the Functor, Applicative, and Monad type classes. The new hierarchy is logical, eliminates many duplicate names from the standard type class definitions, and removes the need for boilerplate Monad -> Applicative instance declarations.
The proposal is detailed in the wiki, along with an example of a legacy module to provide some backwards-compatibility.
Trac metadata
Trac field
Value
Version
7.0.1
Type
Bug
TypeOfFailure
OtherFailure
Priority
normal
Resolution
Unresolved
Component
libraries/base
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Edited
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items
0
Show closed items
No child items are currently assigned. Use child items to break down this issue into smaller parts.
Please note that the attached patches only implement the new Applicative => Monad hierarchy, but do not change any names (as proposed on the wiki page). The deprecation/renaming of redundant definitions may be proposed in a separate ticket.
Proposal tickets are no longer needed as part of the library submissions process. Instead, a normal ticket should be created once consensus has been achieved. Please see the process description for details.
Reusing this old AMP ticket so I don't have to create a new one to track AMP progress;
AMP phase 1 was covered by #8004 (closed), while this ticket is about phase 3 (actually implementing the change)
The AMP was implemented in a single monolithic commit, followed by AMP-related follow-up patches fixing up things as well as generalising some type signatures from Monad to Applicative:
d94de872 ("Make Applicative a superclass of Monad")
65f887e1 ("base: Add some notes about the default impl of (>>)")
Herbert Valerio Riedelchanged title from New Functor => Applicative => Monad Hierarchy to Implement Functor => Applicative => Monad Hierarchy (aka AMP phase 3)
changed title from New Functor => Applicative => Monad Hierarchy to Implement Functor => Applicative => Monad Hierarchy (aka AMP phase 3)