diff options
| author | Ryan Scott <ryan.gl.scott@gmail.com> | 2020-04-07 18:08:17 -0400 |
|---|---|---|
| committer | Ryan Scott <ryan.gl.scott@gmail.com> | 2020-04-08 07:29:31 -0400 |
| commit | 7cc4cd4cbc8d3cc8b03fbced9b57cf6b266fecf7 (patch) | |
| tree | 6693b9459b8db7317cad94bd7f7a6aa20d312775 /docs/users_guide/8.12.1-notes.rst | |
| parent | 255418da5d264fb2758bc70925adb2094f34adc3 (diff) | |
| download | haskell-wip/T18023.tar.gz | |
Use conLikeUserTyVarBinders to quantify field selector typeswip/T18023
This patch:
1. Writes up a specification for how the types of top-level field
selectors should be determined in a new section of the GHC User's
Guide, and
2. Makes GHC actually implement that specification by using
`conLikeUserTyVarBinders` in `mkOneRecordSelector` to preserve the
order and specificity of type variables written by the user.
Fixes #18023.
Diffstat (limited to 'docs/users_guide/8.12.1-notes.rst')
| -rw-r--r-- | docs/users_guide/8.12.1-notes.rst | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/docs/users_guide/8.12.1-notes.rst b/docs/users_guide/8.12.1-notes.rst index 75adb1fb41..4d151d0ab1 100644 --- a/docs/users_guide/8.12.1-notes.rst +++ b/docs/users_guide/8.12.1-notes.rst @@ -18,6 +18,34 @@ Full details Language ~~~~~~~~ +* Record field selectors are now given type signatures that preserve the + user-written order of quantified type variables. Moreover, field selector + type signatures no longer make inferred type variables avaiable for explicit + type application. See :ref:`field-selectors-and-type-applications` for more + details. + + In certain situations, this will constitute a breaking change as this can + affect :extension:`TypeApplications`. For instance, given the following + definitions: :: + + {-# LANGUAGE PolyKinds #-} + + newtype P a = MkP { unP :: Proxy a } + + newtype N :: Type -> Type -> Type where + MkN :: forall b a. { unN :: Either a b } -> N a b + + Previous versions of GHC would give the following types to ``unP`` and + ``unN``: :: + + unP :: forall k (a :: k). P a -> Proxy a + unN :: forall a b. N a b -> Either a b + + GHC will now give them the following types instead: :: + + unP :: forall {k} (a :: k). P a -> Proxy a + unN :: forall b a. N a b -> Either a b + * In obscure scenarios, GHC now rejects programs it previously accepted, but with unhelpful types. For example, if (with ``-XPartialTypeSignatures``) you were to write ``x :: forall (f :: forall a (b :: a -> Type). b _). f _``, GHC previously @@ -40,7 +68,7 @@ Language There is a chance we will tweak the lookup scheme in the future, to make this workaround unnecessary. - + Compiler ~~~~~~~~ |
