... | ... | @@ -2,7 +2,7 @@ |
|
|
The next version (7.10) of GHC is slated to have a drastically changed Prelude,
|
|
|
driven by the (aptly) named Burning Bridges Proposal (BBP), ticket [9586](https://gitlab.haskell.org//ghc/ghc/issues/9586). This proposal generalises
|
|
|
many list operations, e.g. foldr, so they are overloaded - typically becoming members of
|
|
|
either Foldable or Traversable.
|
|
|
either Foldable or Traversable. A complete list pf changes is given at the foot of this page.
|
|
|
|
|
|
|
|
|
This message comes very late in the release process, but we would urge caution before changing.
|
... | ... | @@ -21,28 +21,34 @@ to let the changes stabilize (you rarely get it right the first time). |
|
|
I've discussed this with a number of people, including Simon PJ, and
|
|
|
we have concrete proposals.
|
|
|
|
|
|
|
|
|
Nothing here proposes any change to AMP (which made `Applicative` a superclass of `Monad`). AMP is a change to Preludec, but it was discussed for much longer; was brought in over more than one GHC version (GHC 7.8 had custom warnings to encourage library authors to make changes); and is structurally baked into GHC (because of the connection with desugaring). In contrast BBP is a library-only change. Anyway, there is no suggestion here to row back on AMP.
|
|
|
|
|
|
## Proposal 1:
|
|
|
|
|
|
- Add a new pragma
|
|
|
- Add a new pragma `{-# LANGUAGE Prelude=AlternativePrelude #-}`
|
|
|
|
|
|
- This is a new feature, but it is easy and low-risk to implement.
|
|
|
- Which Prelude you use really is a language choice; appropriate for a LANGUAGE pragma.
|
|
|
- Semantics is name-space only: import Prelude (); import AlternativePrelude
|
|
|
- No effect on desugaring or typing of built-in syntax (list comprehensions, do-notation etc).
|
|
|
- Ship with both old and new prelude.
|
|
|
|
|
|
> `{-# LANGUAGE Prelude=AlternativePrelude #-}`
|
|
|
|
|
|
- This is a new feature, but it is easy and low-risk to implement.
|
|
|
- Which Prelude you use really is a language choice; appropriate for a LANGUAGE pragma.
|
|
|
- Semantics is name-space only: import Prelude (); import AlternativePrelude
|
|
|
- No effect on desugaring or typing of built-in syntax (list comprehensions, do-notation etc).
|
|
|
With these changes, the current and new behaviour are easy to achieve, in the module or in a .cabal file.
|
|
|
The question becomes "what is the default?".
|
|
|
|
|
|
- Ship with both old and new prelude.
|
|
|
- So now old and new behaviour are easy to achieve, in the module or in a .cabal file.
|
|
|
- The question becomes "what is the default".
|
|
|
|
|
|
Another alternative to `{-# LANGUAGE Prelude=AlternativePrelude #-}` would be to use `{-# LANGUAGE NoImplicitPrelude #-}` combined with `import AlternativePrelude`. This requires source-code changes, but has no issues with backward compatibility with earlier versions of GHC.
|
|
|
|
|
|
## Proposal 2:
|
|
|
|
|
|
- Make the default be the old rather than the new.
|
|
|
|
|
|
- Altering the default Prelude API should be done slowly, with lots of warning; because all users get it willy-nilly.
|
|
|
- Unlike AMP, the change is controversial (clearly).
|
|
|
- Easier to make changes to New Prelude if it isn't the default.
|
|
|
Make the default be the old rather than the new.
|
|
|
|
|
|
- Altering the default Prelude API should be done slowly, with lots of warning; because all users get it willy-nilly.
|
|
|
- Unlike AMP, the change is controversial (clearly).
|
|
|
- Easier to make changes to New Prelude if it isn't the default.
|
|
|
|
|
|
## Proposal 3:
|
|
|
|
... | ... | |