... | ... | @@ -210,6 +210,45 @@ h' :: Int |
|
|
h' = g' (\x -> f' x)
|
|
|
```
|
|
|
|
|
|
### Parsing of `{-# SCC ... #-}` pragmas less permissive
|
|
|
|
|
|
GHC 9.0 implements [Proposal 176](https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0176-scc-parsing.rst). Prior to the change, adding an SCC pragma to the code could change its meaning:
|
|
|
|
|
|
```hs
|
|
|
ghci> 1 / 2 / 2
|
|
|
0.25
|
|
|
ghci> 1 / {-# SCC ann #-} 2 / 2
|
|
|
1.0
|
|
|
```
|
|
|
|
|
|
The problem was that `(1 / 2) / 2` turned into `1 / (2 / 2)`. This was fixed by disallowing SCC pragmas in problematic positions, at the cost of disallowing some code that previously was accepted, for example:
|
|
|
|
|
|
```hs
|
|
|
(res, ts) <- withRaw $
|
|
|
{-# SCC attrParser #-} (AddAttributes <$> attrParser)
|
|
|
<|>
|
|
|
{-# SCC pInline #-} (Parsed <$> pInline ilParsers)
|
|
|
```
|
|
|
|
|
|
This now fails with an error:
|
|
|
|
|
|
```
|
|
|
src/Commonmark/Inlines.hs:333:10: error:
|
|
|
A pragma is not allowed in this position: {-# SCC attrParser #-}
|
|
|
|
|
|
|
333 | {-# SCC attrParser #-} (AddAttributes <$> attrParser)
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
```
|
|
|
|
|
|
The fix is to parenthesize the entirety of the SCC-d subexpression:
|
|
|
|
|
|
```hs
|
|
|
(res, ts) <- withRaw $
|
|
|
({-# SCC attrParser #-} AddAttributes <$> attrParser)
|
|
|
<|>
|
|
|
({-# SCC pInline #-} Parsed <$> pInline ilParsers)
|
|
|
```
|
|
|
|
|
|
### Whitespace-sensitive `!`, `~`, `@`, and `$`
|
|
|
|
|
|
GHC 9.0 implements [Proposal 229](https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0229-whitespace-bang-patterns.rst), which means that the `!`, `~`, and `@` characters are more sensitive to preceding and trailing whitespace than they were before. As a result, some things which used to parse one way will now parse differently (or throw a parse error). Here are some particular scenarios that you may encounter:
|
... | ... | |