[Git][ghc/ghc][master] Remove Ptr example from roles docs
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Tue Aug 22 12:08:33 UTC 2023
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
76a4d11b by Jaro Reinders at 2023-08-22T08:08:13-04:00
Remove Ptr example from roles docs
- - - - -
1 changed file:
- docs/users_guide/exts/roles.rst
Changes:
=====================================
docs/users_guide/exts/roles.rst
=====================================
@@ -155,26 +155,7 @@ Role annotations
Allow role annotation syntax.
Sometimes the programmer wants to constrain the inference process. For
-example, the base library contains the following definition: ::
-
- data Ptr a = Ptr Addr#
-
-The idea is that ``a`` should really be a representational parameter,
-but role inference assigns it to phantom. This makes some level of
-sense: a pointer to an ``Int`` really is representationally the same as
-a pointer to a ``Bool``. But, that's not at all how we want to use
-``Ptr``\ s! So, we want to be able to say ::
-
- type role Ptr representational
- data Ptr a = Ptr Addr#
-
-The ``type role`` (enabled with :extension:`RoleAnnotations`) declaration
-forces the parameter ``a`` to be at role representational, not role
-phantom. GHC then checks the user-supplied roles to make sure they don't
-break any promises. It would be bad, for example, if the user could make
-``BadIdea``\'s role be representational.
-
-As another example, we can consider a type ``Set a`` that represents a
+example, we can consider a type ``Set a`` that represents a
set of data, ordered according to ``a``\'s ``Ord`` instance. While it
would generally be type-safe to consider ``a`` to be at role
representational, it is possible that a ``newtype`` and its base type
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/76a4d11b5f2077bbe057deac812f5b211e6a5d1d
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/76a4d11b5f2077bbe057deac812f5b211e6a5d1d
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/20230822/8dd4c04c/attachment-0001.html>
More information about the ghc-commits
mailing list