[Git][ghc/ghc][master] docs: fix ScopedTypeVariables example (#24101)
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Wed Nov 1 00:04:00 UTC 2023
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
7a90020f by Krzysztof Gogolewski at 2023-10-31T20:03:37-04:00
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.
- - - - -
1 changed file:
- docs/users_guide/exts/scoped_type_variables.rst
Changes:
=====================================
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.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/7a90020f167ab016cbfa95decafaa1a54a974bc6
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/7a90020f167ab016cbfa95decafaa1a54a974bc6
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20231031/897fe451/attachment.html>
More information about the ghc-commits
mailing list