[Git][ghc/ghc][wip/int-index/emb-type] vdq: wording in docs and comments
Vladislav Zavialov (@int-index)
gitlab at gitlab.haskell.org
Tue Jul 18 21:28:12 UTC 2023
Vladislav Zavialov pushed to branch wip/int-index/emb-type at Glasgow Haskell Compiler / GHC
Commits:
9f1cc0f6 by Vladislav Zavialov at 2023-07-18T22:51:18+02:00
vdq: wording in docs and comments
- - - - -
4 changed files:
- compiler/GHC/Hs/Pat.hs
- compiler/GHC/Rename/Bind.hs
- compiler/GHC/Rename/Expr.hs
- docs/users_guide/exts/required_type_arguments.rst
Changes:
=====================================
compiler/GHC/Hs/Pat.hs
=====================================
@@ -588,8 +588,8 @@ isIrrefutableHsPat is_strict = goL
-- since we cannot know until the splice is evaluated.
go (SplicePat {}) = False
- -- Unimportant, as isIrrefutableHsPat is only called in contexts
- -- where EmbTyPat is rejected for other reasons (see TcRnIllegalTypePattern).
+ -- The behavior of this case is unimportant, as GHC will throw an error shortly
+ -- after reaching this case for other reasons (see TcRnIllegalTypePattern).
go (EmbTyPat {}) = True
go (XPat ext) = case ghcPass @p of
=====================================
compiler/GHC/Rename/Bind.hs
=====================================
@@ -580,11 +580,10 @@ isOkNoBindPattern (L _ pat) =
SumPat _ lp _ _ -> lpatternContainsSplice lp
ConPat _ _ cpd -> any lpatternContainsSplice (hsConPatArgs cpd)
XPat (HsPatExpanded _orig new) -> patternContainsSplice new
- -- Corner cases
- EmbTyPat{} ->
- -- Unimportant, as isOkNoBindPattern is only called in contexts
- -- where EmbTyPat is rejected for other reasons (see TcRnIllegalTypePattern).
- True
+
+ -- The behavior of this case is unimportant, as GHC will throw an error shortly
+ -- after reaching this case for other reasons (see TcRnIllegalTypePattern).
+ EmbTyPat{} -> True
{- Note [Pattern bindings that bind no variables]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
=====================================
compiler/GHC/Rename/Expr.hs
=====================================
@@ -2305,10 +2305,11 @@ isStrictPattern (L loc pat) =
NPat{} -> True
NPlusKPat{} -> True
SplicePat{} -> True
- EmbTyPat{} ->
- -- Unimportant, as isStrictPattern is only called in contexts
- -- where EmbTyPat is rejected for other reasons (see TcRnIllegalTypePattern).
- False
+
+ -- The behavior of this case is unimportant, as GHC will throw an error shortly
+ -- after reaching this case for other reasons (see TcRnIllegalTypePattern).
+ EmbTyPat{} -> False
+
XPat ext -> case ghcPass @p of
#if __GLASGOW_HASKELL__ < 811
GhcPs -> dataConCantHappen ext
=====================================
docs/users_guide/exts/required_type_arguments.rst
=====================================
@@ -58,6 +58,7 @@ At use sites, we also instantiate this type variable explicitly::
Relation to :extension:`TypeApplications`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
:extension:`RequiredTypeArguments` are similar to :extension:`TypeApplications`
in that we pass a type to a function as an explicit argument. The difference is
that type applications are optional: it is up to the caller whether to write
@@ -105,7 +106,8 @@ indistinguishble from ordinary function arguments::
n = id_vdq Integer 42
-In this example we pass ``Integer`` as opposed to ``(type Integer)``. **This is
-not currently implemented**. But for reasons of forward-compatibility,
-:extension:`RequiredTypeArguments` does not allow the ``type`` syntax; nor does
-it imply that :extension:`ExplicitNamespaces` does.
\ No newline at end of file
+In this example we pass ``Integer`` as opposed to ``(type Integer)``.
+**This is not currently implemented**, but it demonstrates how
+:extension:`RequiredTypeArguments` is not tied to the ``type`` syntax.
+For this reason, using the ``type`` syntax requires enabling the
+:extension:`ExplicitNamespaces` extension separately.
\ No newline at end of file
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9f1cc0f6bc2135b471937725805e35ef9158d2a8
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/9f1cc0f6bc2135b471937725805e35ef9158d2a8
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/20230718/5a9d73a4/attachment-0001.html>
More information about the ghc-commits
mailing list