Opened 3 years ago

Closed 3 years ago

Last modified 10 months ago

#4834 closed proposal (invalid)

New Functor => Applicative => Monad Hierarchy

Reported by: gidyn Owned by:
Priority: normal Milestone: Not GHC
Component: libraries/base Version: 7.0.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

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)

ghc_new_monad_hierarchy.dpatch (110.0 KB) - added by basvandijk 3 years ago.
Prepare GHC for the new monad hierarchy
base_new_monad_hierarchy.dpatch (81.4 KB) - added by basvandijk 3 years ago.
Patch for base that implements the new monad hierarchy
functor_and_applicative_instance_HappyIdentity.dpatch (1.7 KB) - added by basvandijk 3 years ago.
Patch for happy that generates a Functor and Applicative instance for HappyIdentity?

Download all attachments as: .zip

Change History (10)

comment:1 Changed 3 years ago by gidyn

  • Cc gideon@… added

comment:2 Changed 3 years ago by gidyn

Formally proposing this on the mailing lists, with a discussion deadline of 1 February.

Changed 3 years ago by basvandijk

Prepare GHC for the new monad hierarchy

Changed 3 years ago by basvandijk

Patch for base that implements the new monad hierarchy

Changed 3 years ago by basvandijk

Patch for happy that generates a Functor and Applicative instance for HappyIdentity?

comment:3 Changed 3 years ago by basvandijk

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 3 years ago by gidyn

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 3 years ago by igloo

  • Milestone set to Not GHC

comment:6 Changed 3 years ago by igloo

  • Resolution set to invalid
  • Status changed from new to 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 10 months ago by gidyn

  • Cc gideon@… removed
Note: See TracTickets for help on using tickets.