From 0190e9fe6f6f5989fbd016881388c20a7fde3bcb Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Wed, 17 May 2023 13:44:23 -0400 Subject: Extension shuffling (#23291) Where introduced 4 new extensions: - PatternSignatures - ExtendedForAllScope - MethodTypeVariables - ImplicitForAll Tasks of ScopedTypeVariables extension were distributed between PatternSignatures, ExtendedForAllScope and MethodTypeVariables according to the proposal. Now ScopedTypeVaribles only implies these three exntesions. Extension ImplicitForAll saves current behavior. NoImplicitForAll disables implicit bounding of type variables in many contexts. Was introduced one new warning option: -Wpattern-signature-binds It warns when pattern signature binds into scope new type variable. For example: f (a :: t) = ... --- compiler/GHC/Tc/Deriv/Generate.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'compiler/GHC/Tc/Deriv') diff --git a/compiler/GHC/Tc/Deriv/Generate.hs b/compiler/GHC/Tc/Deriv/Generate.hs index 9a76c82b8f..b8678e4344 100644 --- a/compiler/GHC/Tc/Deriv/Generate.hs +++ b/compiler/GHC/Tc/Deriv/Generate.hs @@ -1875,9 +1875,9 @@ of the method. For example, recall: join In the example above, it is imperative that the `a` in the instance signature -for `join` scope over the body of `join` by way of ScopedTypeVariables. -This might sound obvious, but note that in gen_Newtype_binds, which is -responsible for generating the code above, the type in `join`'s instance +for `join` scope over the body of `join` by way of ExtendedForallScope (implied +by ScopedTypeVariables). This might sound obvious, but note that in gen_Newtype_binds, +which is responsible for generating the code above, the type in `join`'s instance signature is given as a Core type, whereas gen_Newtype_binds will eventually produce HsBinds (i.e., source Haskell) that is renamed and typechecked. We must ensure that `a` is in scope over the body of `join` during renaming -- cgit v1.2.1