Feedback on potential change in boot library

Tom Ellis tom-lists-haskell-cafe-2023 at jaguarpaw.co.uk
Wed Nov 27 19:36:58 UTC 2024


On Wed, Nov 27, 2024 at 08:59:51PM +0200, Oleg Grenrus wrote:
> On 27.11.2024 20.49, Oleg Grenrus wrote:
> > PVP suggest to use qualified or explicit import lists.
> > https://wiki.haskell.org/Import_modules_properly
> > 
> > Only then "A client MAY specify that they are insensitive to additions
> > to the API by allowing a range of C values, e.g. build-depends: base >=
> > 2.1.1 && < 2.2."
> > 
> > That's right where in the PVP: https://pvp.haskell.org/ point 5.
> > 
> I forgot to say, that if clients are not insensitive to additions to the
> API, i.e. they do use open imports, the PVP dictates to use strict bounds:
> 
> 4. Client specification. Hence A.B.C uniquely identifies the API. A client
> that wants to specify that they depend on a particular version of the API
> can specify a particular A.B.C and be sure of getting that API only. For
> example, build-depends: mypkg >= 2.1.1 && < 2.1.2.
> 
> which no-one does, but that's their fault.
> 
> I'd argue that a design mistake in Haskell. We should not have open imports,
> nor implicit Prelude. The default thing (import Foo) does the wrong thing.
> Compare to Rust where "use foo" isn't a wildcard import.
> https://www.lurklurk.org/effective-rust/wildcard.html

I agree with everything you've said in this thread, Oleg.  Digressing
slightly, I think there's scope for a new language extension
("ImportQualifiedDefault"?) that makes

    import Foo
    import Bar unqualifed

mean what

    import Foo qualified
    import Bar

currently means.

Tom


More information about the ghc-devs mailing list