Breaking changes to the base library
Edward Kmett
ekmett at gmail.com
Sun Jun 20 14:57:49 UTC 2021
The breakage concern is why Data.List wound up in its limbo-like state of
re-exporting the Foldable-polymorphic combinators since 7.10 -- while
"weird", it was the only option that didn't have to choose between removing
the names from Data.List exports entirely and breaking unqualified imports
of Data.List.
With the monomorphized combinators in place, Data.List should be considered
a 'qualified' import like Data.Map. We definitely need to do more to
communicate that this is changing and how users should adjust their code to
suit. After all, by far the most common intended import from Data.List is
the humble 'sort', which doesn't conflict.
-Edward
On Sun, Jun 20, 2021 at 4:45 AM Chris Smith <cdsmith at gmail.com> wrote:
> Yikes, this is going to break nearly everything. Definitely good to let
> people know.
>
> On Sun, Jun 20, 2021 at 7:43 AM Ben Gamari <ben at smart-cactus.org> wrote:
>
>> Harendra Kumar <harendra.kumar at gmail.com> writes:
>>
>> > I see the following errors when compiling with ghc head version:
>> >
>> > $ ghc-stage2 --version
>> > The Glorious Glasgow Haskell Compilation System, version 9.3.20210608
>> >
>> > $ cabal build --with-compiler ghc-stage2 --allow-newer
>> >
>> > Data/Colour/CIE.hs:80:12: error:
>> > Ambiguous occurrence ‘sum’
>> > It could refer to
>> > either ‘Prelude.sum’,
>> > imported from ‘Prelude’ at Data/Colour/CIE.hs:25:8-22
>> > (and originally defined in ‘Data.Foldable’)
>> > or ‘Data.List.sum’,
>> > imported from ‘Data.List’ at Data/Colour/CIE.hs:41:1-16
>> > (and originally defined in ‘GHC.List’)
>> > |
>> > 80 | total = sum $ map fst l
>> > | ^^^
>> >
>> > Can someone briefly describe this change and what's the recommended way
>> of
>> > fixing this? Just hide the Data.List definition? I do not see this
>> > mentioned in the release notes of 9.2/9.4 here:
>> > https://ghc.gitlab.haskell.org/ghc/doc/users_guide/9.2.1-notes.html
>> >
>> Indeed, this is due to the monomorphic Data.List proposal, which the
>> CLC decided would accompany the addition of Data.List.singleton. The
>> correct fix here is to either qualify the import of `Data.List` or add
>> an explicit import list. I'll try to remember to add a note about this
>> to the release notes and migration guide.
>>
>>
>> Cheers,
>>
>> - Ben
>>
>> _______________________________________________
>> ghc-devs mailing list
>> ghc-devs at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
>>
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20210620/864a974b/attachment.html>
More information about the ghc-devs
mailing list