[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 3 commits: chore: Correct typo in the gitlab MR template

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Tue Nov 21 20:52:16 UTC 2023



Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC


Commits:
77834263 by Owen Shepherd at 2023-11-21T15:52:11-05:00
chore: Correct typo in the gitlab MR template

[skip ci]

- - - - -
91b5d191 by Rodrigo Mesquita at 2023-11-21T15:52:11-05:00
Improve error message when reading invalid `.target` files

A `.target` file generated by ghc-toolchain or by configure can become
invalid if the target representation (`Toolchain.Target`) is changed
while the files are not re-generated by calling `./configure` or
`ghc-toolchain` again. There is also the issue of hadrian caching the
dependencies on `.target` files, which makes parsing fail when reading
reading the cached value if the representation has been updated.

This patch provides a better error message in both situations, moving
away from a terrible `Prelude.read: no parse` error that you would get
otherwise.

Fixes #24199

- - - - -
58857f25 by Ben Gamari at 2023-11-21T15:52:12-05:00
users guide: Note that QuantifiedConstraints implies ExplicitForAll

Fixes #24025.

- - - - -


3 changed files:

- .gitlab/merge_request_templates/Default.md
- docs/users_guide/exts/quantified_constraints.rst
- hadrian/src/Hadrian/Oracles/TextFile.hs


Changes:

=====================================
.gitlab/merge_request_templates/Default.md
=====================================
@@ -30,7 +30,7 @@ label can be applied to perform additional validation checks if your MR affects
 unusual configuration.
 
 Once your change is ready please remove the `WIP:` tag and wait for review. If
-no one has offerred review in a few days then please leave a comment mentioning
+no one has offered a review in a few days then please leave a comment mentioning
 @triagers and apply the ~"Blocked on Review" label.
 
 [notes]: https://gitlab.haskell.org/ghc/ghc/wikis/commentary/coding-style#comments-in-the-source-code


=====================================
docs/users_guide/exts/quantified_constraints.rst
=====================================
@@ -6,6 +6,7 @@ Quantified constraints
 .. extension:: QuantifiedConstraints
     :shortdesc: Allow ``forall`` quantifiers in constraints.
 
+    :implies: :extension:`ExplicitForAll`
     :since: 8.6.1
 
     Allow constraints to quantify over types.


=====================================
hadrian/src/Hadrian/Oracles/TextFile.hs
=====================================
@@ -163,14 +163,23 @@ textFileOracle = do
         putVerbose $ "| TargetFile oracle: reading " ++ quote file ++ "..."
         mtarget <- readMaybe <$> readFile' file
         case mtarget of
-          Nothing -> error $ "Failed to read a Toolchain.Target from " ++ quote file
+          Nothing -> error $ unlines ["Error parsing a Toolchain.Target from " ++ quote file,
+                                      "Perhaps the `.target` file is out of date.",
+                                      "Try re-running `./configure`."
+                                     ]
+
           Just target -> return (target :: Toolchain.Target)
     void $ addOracleCache $ \(TargetFile file) -> tf file
 
 -- Orphan instances for (ShakeValue Toolchain.Target)
 instance Binary Toolchain.Target where
-  put = put  . show
-  get = read <$> get
+  put = put . show
+  get = fromMaybe (error $ unlines ["Error parsing a toolchain `.target` file from its binary representation in hadrian.",
+                                    "This is likely caused by a stale hadrian/shake cache",
+                                    "which has saved an old `.target` file that can't be parsed",
+                                    "into a more recent `Toolchain.Target`. It is recommended to reset",
+                                    "by running `./hadrian/build clean`."
+                                   ]) . readMaybe <$> get
 
 instance Hashable Toolchain.Target where
   hashWithSalt s = hashWithSalt s . show



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d9475af88d267c7dcb79ec54dff55cb0c6842860...58857f250e9c55f0eb1434850e70b4b456d6348d

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d9475af88d267c7dcb79ec54dff55cb0c6842860...58857f250e9c55f0eb1434850e70b4b456d6348d
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20231121/b85ae46c/attachment-0001.html>


More information about the ghc-commits mailing list