diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2019-12-26 19:47:04 -0500 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-01-25 05:21:40 -0500 |
commit | c3fde723633d1788e4ded8c6f59eb7cef1ae95fd (patch) | |
tree | 60f6c00540541449b7aada6765048de49af9f371 /docs/users_guide/8.12.1-notes.rst | |
parent | 86966d48954db4a8bd40046af259ed60aed535eb (diff) | |
download | haskell-c3fde723633d1788e4ded8c6f59eb7cef1ae95fd.tar.gz |
Handle local fixity declarations in DsMeta properly
`DsMeta.rep_sig` used to skip over `FixSig` entirely, which had the
effect of causing local fixity declarations to be dropped when quoted
in Template Haskell. But there is no good reason for this state of
affairs, as the code in `DsMeta.repFixD` (which handles top-level
fixity declarations) handles local fixity declarations just fine.
This patch factors out the necessary parts of `repFixD` so that they
can be used in `rep_sig` as well.
There was one minor complication: the fixity signatures for class
methods in each `HsGroup` were stored both in `FixSig`s _and_ the
list of `LFixitySig`s for top-level fixity signatures, so I needed
to take action to prevent fixity signatures for class methods being
converted to `Dec`s twice. I tweaked `RnSource.add` to avoid putting
these fixity signatures in two places and added
`Note [Top-level fixity signatures in an HsGroup]` in `GHC.Hs.Decls`
to explain the new design.
Fixes #17608. Bumps the Haddock submodule.
Diffstat (limited to 'docs/users_guide/8.12.1-notes.rst')
-rw-r--r-- | docs/users_guide/8.12.1-notes.rst | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/docs/users_guide/8.12.1-notes.rst b/docs/users_guide/8.12.1-notes.rst index 5cd7131fac..8f2c26041e 100644 --- a/docs/users_guide/8.12.1-notes.rst +++ b/docs/users_guide/8.12.1-notes.rst @@ -42,6 +42,10 @@ Template Haskell forms have now been generalised in terms of a minimal interface necessary for the implementation rather than the overapproximation of the ``Q`` monad. + - Template Haskell quotes now handle fixity declarations in ``let`` and + ``where`` bindings properly. Previously, such fixity declarations would + be dropped when quoted due to a Template Haskell bug. + ``ghc-prim`` library ~~~~~~~~~~~~~~~~~~~~ @@ -56,6 +60,20 @@ Template Haskell => ([Word8] -> a) -> ModGuts -> CoreM (ModuleEnv [a], NameEnv [a]) + - The meaning of the ``hs_fixds`` field of ``HsGroup`` has changed slightly. + It now only contains fixity signatures defined for top-level declarations + and class methods defined *outside* of the class itself. Previously, + ``hs_fixds`` would also contain fixity signatures for class methods defined + *inside* the class, such as the fixity signature for ``m`` in the following + example: :: + + class C a where + infixl 4 `m` + m :: a -> a -> a + + If you wish to attain the previous behavior of ``hs_fixds``, use the new + ``hsGroupTopLevelFixitySigs`` function, which collects all top-level fixity + signatures, including those for class methods defined inside classes. ``base`` library ~~~~~~~~~~~~~~~~ |