Opened 8 years ago
Closed 4 years ago
#4834 closed task (fixed)
Implement Functor => Applicative => Monad Hierarchy (aka AMP phase 3)
Reported by: | gidyn | Owned by: | |
---|---|---|---|
Priority: | high | Milestone: | 7.10.1 |
Component: | libraries/base | Version: | 7.0.1 |
Keywords: | report-impact | Cc: | ekmett, thoughtpolice, hvr |
Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
Type of failure: | None/Unknown | Test Case: | |
Blocked By: | Blocking: | ||
Related Tickets: | #8004 | Differential Rev(s): | Phab:D13 |
Wiki Page: |
Description
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.
Attachments (3)
Change History (15)
comment:1 Changed 8 years ago by
Cc: | gideon@… added |
---|
comment:2 Changed 8 years ago by
Changed 8 years ago by
Attachment: | ghc_new_monad_hierarchy.dpatch added |
---|
Prepare GHC for the new monad hierarchy
Changed 8 years ago by
Attachment: | base_new_monad_hierarchy.dpatch added |
---|
Patch for base that implements the new monad hierarchy
Changed 8 years ago by
Attachment: | functor_and_applicative_instance_HappyIdentity.dpatch added |
---|
Patch for happy that generates a Functor and Applicative instance for HappyIdentity
comment:3 Changed 8 years ago by
All my patches can also be pulled from my publicly available ghc repository:
darcs pull http://bifunctor.homelinux.net/~bas/ghc/ darcs pull http://bifunctor.homelinux.net/~bas/ghc/libraries/base darcs pull http://bifunctor.homelinux.net/~bas/ghc/...
Also see the generated haddock documentation of the base library with the patches applied.
comment:4 Changed 8 years ago by
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.
comment:5 Changed 8 years ago by
Milestone: | → Not GHC |
---|
comment:6 Changed 8 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
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.
comment:7 Changed 6 years ago by
Cc: | gideon@… removed |
---|
comment:8 Changed 4 years ago by
Cc: | ekmett thoughtpolice hvr added |
---|---|
Differential Rev(s): | → Phab:D13 |
Keywords: | report-impact added |
Milestone: | Not GHC → 7.10.1 |
Priority: | normal → high |
Related Tickets: | → #8004 |
Resolution: | invalid |
Status: | closed → new |
Type: | proposal → task |
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, 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:
- d94de87252d0fe2ae97341d186b03a2fbe136b04 ("Make Applicative a superclass of Monad")
- 65f887e1a0d864526f6a2609a3afc2c151c25e38 ("base: Add some notes about the default impl of
(>>)
") - 6477b3dc058a92b825ef30d98797603b4a44a001 ("testsuite: AMPify ioprof.hs")
- 29e50da4c274eba0e444ce4b95294a76832908f2 ("testsuite: AMPify T3001-2")
- f636faa7b2b7fc1d0663f994ad08f365d39a746d ("Set default-impl of
mapM
/sequence
methods totraverse
/sequenceA
") - a07ce1654ac5b8033f2daf9270c6e182415b69ca ("Generalise
Control.Monad.{when,unless,guard}
") - bf3329104c971c84ab178f3ded88254b9594f9cc ("Generalise
guard
for real this time") - a1b539142d7853bc02c36f1b3e8d489a9864f0e9 ("testsuite: fix T5751 build failure (AMP)")
- b30b185e5c653dfed948d71ce2336be70be3b418 ("testsuite: fix T1735_Help/State.hs build failure (AMP)")
- abba3812e657a5267bba406d2c877c1cb5d978f9 ("Improve Applicative definitions")
comment:9 Changed 4 years ago by
Summary: | New Functor => Applicative => Monad Hierarchy → Implement Functor => Applicative => Monad Hierarchy (aka AMP phase 3) |
---|
comment:11 Changed 4 years ago by
Replying to Herbert Valerio Riedel <hvr@…>:
...also merged to ghc-7.10 via 262f7a85bb1d40770245b990527eb0bee7c20195
comment:12 Changed 4 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Formally proposing this on the mailing lists, with a discussion deadline of 1 February.