-
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
Fix #9534 Add constructor PPC64LE
to type Arch
, for powerpc64le
#9535
Conversation
I did not know what to do about the failing 'validate' CI. Perhaps naively, I just changed the hash to the one that was observed. |
48b34d6
to
05c8adf
Compare
That's probably fine, but we need to understand why the hash changed --- perhaps it's computed using the datatype you added a constructor to? BTW, does the change affect parsing of the .cabal files? If so, it needs to be guarded behind the 3.12 cabal-version. Some recent PRs did the same, so should be easy to find. But perhaps, by luck, it affects checksums but not the cabal format. I'm still fuzzy on what breaking changes need to be guarded by cabal-version format stamp and what only by a major cabal package version bump. |
@Mikolaj, on Cabal files, I think not, based on https://cabal.readthedocs.io/en/stable/cabal-package.html#conditions. That says for |
@Mikolaj, it looks to me like the Cabal User Guide documentation is incomplete, in that module Distribution.Fields.ConfVar ...
parser :: Parser (Condition ConfVar)
parser = condOr
where
...
osCond = Var . OS <$ string "os" <*> parens fromParsec
...
archCond = Var . Arch <$ string "arch" <*> parens fromParsec
module Distribution.Types.ConfVar ...
-- | A @ConfVar@ represents the variable type used.
data ConfVar
= OS OS
| Arch Arch
| PackageFlag FlagName
| Impl CompilerFlavor VersionRange
deriving (Eq, Show, Typeable, Data, Generic)
module Distribution.System
...
archAliases :: ClassificationStrictness -> Arch -> [String]
archAliases Strict _ = []
...
instance Pretty Arch where
pretty (OtherArch name) = Disp.text name
pretty other = Disp.text (lowercase (show other))
instance Parsec Arch where
parsec = classifyArch Strict <$> parsecIdent
classifyArch :: ClassificationStrictness -> String -> Arch
classifyArch strictness s =
fromMaybe (OtherArch s) $ lookup (lowercase s) archMap
where
archMap =
[ (name, arch)
| arch <- knownArches
, name <- prettyShow arch : archAliases strictness arch
] I think the use of strictness EDIT: Perhaps it is more complex than that. If Cabal 'permissively' maps "powerpc64" and "powerpc64le" to |
Yes, the documentation if quite outdated, despite the continuous effort to keep it in shape. Thanks a lot for looking deeper into this. If you are stuck, feel free to ask on Matrix --- some people understand this better than me. |
BTW, let me a add a crosslink to the issue this PR fixes (I think?): #9534 |
Further on On one view, the specification is unaffected. It was On another view, the (implicit) specification is unaffected even it is understood, in principle, to specify the set of valid values of On third view, the (implicit) specification is affected. This view would assume that the set of valid values of Personally, I prefer the first two views over the third. It seems to me that the third has 'the tail wagging the dog', but I could see that some might say that is too Platonic a perspective, given the circumstances. |
Related to this issue/pull request but not fixed by it, Cabal treats However, it appears to me that other Cabal 'synonyms' are not truely synonyms. They include:
EDIT: So if people follow and agree with my reasoning for data constrctors |
It crosslinks from commits (where you mentioned the issue), but then the link points to a commit, from which one can't easily reach the PR. I will ask at today's cabal dev meeting about the "guarding behind |
@Mikolaj, I will try to attend the Cabal dev meeting (my first). |
Following the 21 Dec 2023 Cabal dev meeting, I will compare |
I am returning to this issue/pull request because it appears that the GHC project (based on @mpickering's comment) may well not have a desire to provide a 'canonical' 'architecture' type useful to all of GHC, Cabal and Stack. |
Right. @mpickering: is this the right approach then, given https://gitlab.haskell.org/ghc/ghc/-/issues/24283#note_542188? If so, could you review this here PR? |
I am convinced by Matthew's argument, so this looks good to me too. Unfortunately it seems you'll have to resolve a conflict in the Structured.hs hashes @mpilgrem. Thanks for the patch! |
bf0e225
to
f421efd
Compare
Looks good! @mpilgrem: a kind reminder of how to proceed: https://github.com/haskell/cabal/blob/master/CONTRIBUTING.md#github-pull-request-conventions |
Also makes consequent changes.
Also makes consequent changes.