-
Notifications
You must be signed in to change notification settings - Fork 697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cabal library API breakage in 3.14.0.0 #10559
Comments
One more with |
One more with
|
... The Seems like the post-refactor API is incomplete; the new pattern synonym Hi @sheaf, can I ask you as the implementor of #9718 — am I missing a way to rewrite snippets that use Cabal-the-library like so miniRepro :: BuildFlags
miniRepro = defaultBuildFlags {buildVerbosity = undefined} against Cabal 3.14?.. That (I think, correctly) yields:
Under spoiler, I've minimized a bare ghci-ready model test, to spare us all of traversing Cabal codebase for smoother discussion: minified exampleFoo.hs: {-# LANGUAGE PatternSynonyms, ViewPatterns #-}
module Foo
( Sauce (BuildPun, buildDolor, buildSitamet)
, defaultSauce
) where
-- exported without constructor
data Sauce = Sauce
{ lorem :: Int
, ipsum :: Bool
, buildSauce :: CommonSauce
}
data CommonSauce = CommonSauce
{ dolor :: String
, sitamet :: Maybe ()
}
pattern BuildPun :: String -> Maybe () -> Sauce
pattern BuildPun
{ buildDolor
, buildSitamet
} <- ( buildSauce -> CommonSauce { dolor=buildDolor, sitamet=buildSitamet })
defaultSauce = Sauce 42 False defaultCommonSauce
defaultCommonSauce = undefined Bar.hs: module Bar where
import Foo (Sauce (..), defaultSauce)
example :: Sauce
example = defaultSauce { buildDolor = "WAT" } Same error message:
Not a heavy user of pattern synonyms myself, so apologies for perhaps obvious question, and thanks in advance. |
To set the verbosity field of setBuildFlagsVerbosity :: Verbosity -> BuildFlags -> BuildFlags
setBuildFlagsVerbosity v flags@(BuildFlags { buildCommonFlags = common )} =
flags { buildCommonFlags = common { setupVerbosity = v } } Probably the most backward-compatible way to fix this would be to use lenses that would be provided by the Cabal library, but at the moment the Cabal library is very inconsistent about which lenses it provides. IMO Cabal should expose a |
That's quite awkward 🫤 Also realize it must be wrapped into CPP version checks (which I see you did in cabal tests). Wasn't the point of refactor to simplify?.. Anyhow, thanks for the reply, I'll try to adapt to this change as well. |
Adaptations to API breakages in Cabal 3.14.0.0, discussed in haskell/cabal#10559 Resolves #85.
Adaptations to API breakages in Cabal 3.14.0.0, discussed in haskell/cabal#10559 Resolves #85.
hey @ulidtko ! thanks for raising this issue! just wanted to make it explicit here: do you expect Cabal to document all API changes between major versions? does any other package track these? I saw how some packages do highlight some "notable" API changes in the changelog, and we certainly could retroactively fix the notes for 3.14.0.0, and 3.14.1.0 can include these as well. But it's not clear to me that anyone has a reliable and exhaustive reporting of all API changes. I'd be curious to know how people set this up especially in case of big packages like Cabal+Cabal-syntax with ~60K LOC and several dozen modules and active contributors community. |
If migrating is not trivial — this seems to be the case — as a user I would be quite happy to see a migration guide. |
Hi @ulysses4ever, thanks for the acknowledgement and response. Per my standards, this issue itself is "documentation" already; of course I won't be demanding exhaustive listings of all changes in release notes. That's what git commit logs are for; and everyone wants release notes to be short read, too. But nevermind my opinion; try to keep in mind the wider haskellers community, including less experienced and "primarily using another language" members. You upgrade a dependency (potentially a distant transitive one) — your thing breaks — you go check changelogs, immediately. That's muscle memory, that I hope all sides would agree is nice to cultivate. Not documenting breaking changes simply erodes that culture of keepachangelog. Then things get that sticky fame of "breaks all the time" 😒 Consider e.g. that I don't have a good link to give to a teammate to point out precisely what happened; in a hurry, they'll just come out with the wrong, oversimplified conclusion. As a haskeller myself, I can of course "enjoy" static breakage, at compile time. It should be said: that's lightyears better than runtime breakage. However, it's a nontrivial "haha, funny talk" idea to grasp; it takes experience to internalize it. So here, I'm appealing at the community again. ... And while at it, let me spell out these from fresh memory, for posterity. Migration stepsConstructors of
|
This is fantastic and I will incorporate this via a PR as soon as the weekend kicks in. |
Up until version 3.14, the public module
Distribution.Simple
of Cabal-the-library has been exporting these names:GlobalPackageDB
UserPackageDB
SpecificPackageDB
as constructors of
PackageDB
data type (indirectly, via reexport of Distribution.Simple.Compiler).The patchset #10256, specifically commit 90fbf08, having shuffled the definitions a little bit, is now causing compile errors in either of two forms:
with
import Distribution.Simple.Compiler (PackageDB(..))
being already there;or
Please at least document this in release notes, as it's a breaking change.
(BTW there's no 3.14.0.0 on https://github.com/haskell/cabal/releases )
The text was updated successfully, but these errors were encountered: