From 7a90020f167ab016cbfa95decafaa1a54a974bc6 Mon Sep 17 00:00:00 2001 From: Krzysztof Gogolewski <krzysztof.gogolewski@tweag.io> Date: Wed, 18 Oct 2023 17:01:34 +0200 Subject: [PATCH] docs: fix ScopedTypeVariables example (#24101) The previous example didn't compile. Furthermore, it wasn't demonstrating the point properly. I have changed it to an example which shows that 'a' in the signature must be the same 'a' as in the instance head. --- docs/users_guide/exts/scoped_type_variables.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/users_guide/exts/scoped_type_variables.rst b/docs/users_guide/exts/scoped_type_variables.rst index ee6a77f32a3..feeb65ecb7f 100644 --- a/docs/users_guide/exts/scoped_type_variables.rst +++ b/docs/users_guide/exts/scoped_type_variables.rst @@ -293,11 +293,11 @@ signatures/ of the methods. For example, the following will be accepted without explicitly enabling :extension:`ScopedTypeVariables`: :: class D a where - m :: [a] -> a + m :: a -> a - instance D [a] where + instance Num a => D [a] where m :: [a] -> [a] - m = reverse + m x = map (*2) x Note that writing ``m :: [a] -> [a]`` requires the use of the :extension:`InstanceSigs` extension. -- GitLab