[Git][ghc/ghc][wip/T25647] update note
Patrick (@soulomoon)
gitlab at gitlab.haskell.org
Sun Feb 9 08:14:47 UTC 2025
Patrick pushed to branch wip/T25647 at Glasgow Haskell Compiler / GHC
Commits:
668ca485 by Patrick at 2025-02-09T16:14:37+08:00
update note
- - - - -
2 changed files:
- compiler/GHC/Tc/Utils/TcMType.hs
- compiler/GHC/Tc/Utils/Unify.hs
Changes:
=====================================
compiler/GHC/Tc/Utils/TcMType.hs
=====================================
@@ -695,18 +695,17 @@ the thinking.
{- Note [NoDefTauTv]
~~~~~~~~~~~~~~~~~
-A NoDefTauTv behaves like a TauTv, except that when it is not unified
-with anything, it should not be defaulted.
+A NoDefTauTv behaves like a TauTv, except that it should not be defaulted.
+Making it more polymorphic than a TauTv which can be defaulted.
It is used for a anonymous wildcard in a type family, e.g.
type Dix8 :: RuntimeRep -> Type
data family Dix8 r
newtype instance Dix8 _ = Dix8 Int
-We want to keep `_` polymorphic, so it behaves like a named wildcard.
-When unified other type, it should be replaced by the other type, since
-the `not unified with anything` assumption is break. It's property no longer
-holds.
+We want to keep `_` polymorphic, so it behaves more like a named wildcard.
+
+NB. Should we default `_` if XNoPolyKind is on?
-}
{- Note [TyVarTv]
=====================================
compiler/GHC/Tc/Utils/Unify.hs
=====================================
@@ -2575,11 +2575,13 @@ lhsPriority tv
TyVarTv -> 1
ConcreteTv {} -> 2
TauTv -> 3
- RuntimeUnkTv -> 4
- NoDefTauTv -> 5 -- ^ when unifying with other, prefer to keep the other.
- -- see Note [NoDefTauTv] for more details.
- -- NB. it is not clear to me(soulomoon), RuntimeUnkTv should
- -- be higher than NoDefTauTv or not.
+ NoDefTauTv -> 4 -- ^ when unifying with other, prefer to keep the other.
+ -- Since NoDefTauTv is more polymorphic than tau,
+ -- see Note [NoDefTauTv] for more details.
+
+ -- NB. it is not clear to me(soulomoon), RuntimeUnkTv should
+ -- be higher than NoDefTauTv or not.
+ RuntimeUnkTv -> 5
{- Note [Unification preconditions]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/668ca48567d0f7d5ba2de90f5919827f30e19c86
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/668ca48567d0f7d5ba2de90f5919827f30e19c86
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/20250209/3d5d2ee6/attachment-0001.html>
More information about the ghc-commits
mailing list