Drastic Prelude changes imminent

Herbert Valerio Riedel hvr at gnu.org
Sun Feb 1 16:06:41 UTC 2015


Mark,

On 2015-02-01 at 15:00:33 +0100, Mark Lentczner wrote:

[...]

>> If we don't intend to make Foldable/Traversable a first-class citizen
>> of Haskell to help increase its adoption, why have it in `base` in
>> the first place?

> "first-class citizen" better not equate to "you get it with the Prelude"
> nor "you can always import it unqualified". 

> If we use either of those as the bar, then we will end up with huge
> number of things in default scope, and we'll namespace it by prefix
> strings *alá PHP.*

That's bordering on slippery-slope argumentation and misrepresenting
what the changes due to FTP actually are. FTP is mostly about replacing
*existing* symbols in the Prelude with their generalised counterparts
because they were *already* there (otherwise they wouldn't cause
conflict in the first place).

The few newly added symbols to the `Prelude` scope (specifically:
Foldable(foldMap), Traversable(traverse), and Monoid(..) ) were done to
satisfy the expectation to be able define instances as well as
type-signatures without requiring additional imports, make the Prelude
self-contained/closed. This particular design choice is not mandatory
for the FTP.


>> Moreover, how do we justify (other than by historic accident) that the
>> more generalised synonyms are stored away in modules … Do lists really
>> require such a special privilege?

> Yup, historic accident *and* lists do get special privilege. We could
> easily turn your question around: Why do Foldable and Traversable deserve
> to be not only importable unqualified, but by all programs as part of the
> Prelude?

Because they are more general and more powerful than their
list-specialised counterparts. They can (almost) always be used in place
of their more specialised versions. The converse, however, does not
generally hold. Moreover, having them available by default in scope
encourages users to think in terms of them and look for opportunities
(i.e. recognize common shapes/patterns) to levarage the abstraction.

>> Why not rather place the more general versions into the default scope
>> … This results in a more symmetric
>> situation.

> It might be more symmetric. But I don't see universal acclaim that Foldable
> and Traversable are a generalization to be preferred over lists in the
> majority of code. And the "why not" is because it is a big change to the
> Prelude with negative consequences judged significant by many of us.

Could you please spell out the significant negative consequences you're
referring to?  Otherwise it's too vague and denies me the chance to
address your concern (and we are considering technical solutions to make
the FTP more palatable to all concerned parties, but this requires being
able exactly identify the pain points).

-- hvr


More information about the Libraries mailing list