[Git][ghc/ghc][wip/less-defaulting] Change the defaulting rules in commitFlexi
Krzysztof Gogolewski (@monoidal)
gitlab at gitlab.haskell.org
Mon Jun 19 18:01:04 UTC 2023
Krzysztof Gogolewski pushed to branch wip/less-defaulting at Glasgow Haskell Compiler / GHC
Commits:
f95a3336 by Krzysztof Gogolewski at 2023-06-19T20:00:49+02:00
Change the defaulting rules in commitFlexi
- Multiplicity isn't special, default to Any
- RuntimeRep and Levity are special only when concrete
- - - - -
1 changed file:
- compiler/GHC/Tc/Zonk/Type.hs
Changes:
=====================================
compiler/GHC/Tc/Zonk/Type.hs
=====================================
@@ -456,21 +456,20 @@ commitFlexi tv zonked_kind
-- y = (\x -> True) undefined
-- We need *some* known RuntimeRep for the x and undefined, but no one
-- will choose it until we get here, in the zonker.
- | isRuntimeRepTy zonked_kind
- -> do { traceTc "Defaulting flexi tyvar to LiftedRep:" (pprTyVar tv)
- ; return liftedRepTy }
- | isLevityTy zonked_kind
- -> do { traceTc "Defaulting flexi tyvar to Lifted:" (pprTyVar tv)
- ; return liftedDataConTy }
- | isMultiplicityTy zonked_kind
- -> do { traceTc "Defaulting flexi tyvar to Many:" (pprTyVar tv)
- ; return manyDataConTy }
- | Just (ConcreteFRR origin) <- isConcreteTyVar_maybe tv
- -> do { addErr $ TcRnZonkerMessage (ZonkerCannotDefaultConcrete origin)
- ; return (anyTypeOfKind zonked_kind) }
- | otherwise
- -> do { traceTc "Defaulting flexi tyvar to Any:" (pprTyVar tv)
- ; return (anyTypeOfKind zonked_kind) }
+ -> case isConcreteTyVar_maybe tv of
+ Nothing
+ -> do { traceTc "Defaulting flexi tyvar to Any:" (pprTyVar tv)
+ ; return (anyTypeOfKind zonked_kind) }
+ Just (ConcreteFRR origin)
+ | isRuntimeRepTy zonked_kind
+ -> do { traceTc "Defaulting flexi tyvar to LiftedRep:" (pprTyVar tv)
+ ; return liftedRepTy }
+ | isLevityTy zonked_kind
+ -> do { traceTc "Defaulting flexi tyvar to Lifted:" (pprTyVar tv)
+ ; return liftedDataConTy }
+ | otherwise
+ -> do { addErr $ TcRnZonkerMessage (ZonkerCannotDefaultConcrete origin)
+ ; return (anyTypeOfKind zonked_kind) }
RuntimeUnkFlexi
-> do { traceTc "Defaulting flexi tyvar to RuntimeUnk:" (pprTyVar tv)
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f95a33363b385508d77de3983179e7cccc2318a3
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f95a33363b385508d77de3983179e7cccc2318a3
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/20230619/39670538/attachment-0001.html>
More information about the ghc-commits
mailing list