[Git][ghc/ghc][wip/int-index/wildcard-binders] comments only

Vladislav Zavialov (@int-index) gitlab at gitlab.haskell.org
Sat Aug 31 14:04:08 UTC 2024



Vladislav Zavialov pushed to branch wip/int-index/wildcard-binders at Glasgow Haskell Compiler / GHC


Commits:
fa21f7b5 by Vladislav Zavialov at 2024-08-31T13:38:00+00:00
comments only

- - - - -


2 changed files:

- compiler/GHC/Hs/Type.hs
- compiler/Language/Haskell/Syntax/Type.hs


Changes:

=====================================
compiler/GHC/Hs/Type.hs
=====================================
@@ -426,8 +426,9 @@ type family result variables (the latter being part of TypeFamilyDependencies):
 This restriction is placed solely because such binders have not been proposed
 and there is no known use case for them. Shall we see user demand for wildcard
 binders in these contexts, adding support for them would be as easy as dropping
-the checks that reject them. That's because the most straightforward and uniform
-way of dealing with wildcard binders is to simply generate a fresh name.
+the checks that reject them. The rest of the compiler can handle all wildcard
+binders regardless of context by generating a fresh name (see `tcHsBndrVarName`
+in GHC.Tc.Gen.HsType and `repHsBndrVar` in GHC.HsToCore.Quote).
 
 That is, in type declarations we have:
 


=====================================
compiler/Language/Haskell/Syntax/Type.hs
=====================================
@@ -791,7 +791,13 @@ following contexts:
 
    Again, `a` and `b` are type variable binders.
 
-3. In constructor patterns, as long as the conditions outlined in
+3. In type family result signatures (with TypeFamilyDependencies)
+
+      type family F a = r | r -> a
+
+   The `r` immediately to the right of `=` is a type variable binder.
+
+4. In constructor patterns, as long as the conditions outlined in
    Note [Type patterns: binders and unifiers] are satisfied
 
       fn (MkT @a @b x y) = ...



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/fa21f7b5f43d4a51dd122bad02a2f0820284e94b

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/fa21f7b5f43d4a51dd122bad02a2f0820284e94b
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/20240831/c4ea6795/attachment-0001.html>


More information about the ghc-commits mailing list