[Git][ghc/ghc][wip/sand-witch/check- at -binders] 2 commits: fixup! Lazy skolemisation for @a-binders (17594)
Andrei Borzenkov (@sand-witch)
gitlab at gitlab.haskell.org
Fri Dec 15 18:05:32 UTC 2023
Andrei Borzenkov pushed to branch wip/sand-witch/check- at -binders at Glasgow Haskell Compiler / GHC
Commits:
4dc75d27 by Andrei Borzenkov at 2023-12-15T22:00:30+04:00
fixup! Lazy skolemisation for @a-binders (17594)
- - - - -
69b07bc3 by Andrei Borzenkov at 2023-12-15T22:05:19+04:00
Parser, renamer, type checker for @a-binders (17594)
As a part of GHC Proposal 448 were introduced invisible
type patterns (@a-patterns) in functions and lambdas:
id1 :: a -> a
id1 @t x = x :: t
id2 :: a -> a
id2 = \ @t x -> x :: t
Was introduced new data type ArgPat and now Match stores it
instead of Pat. ArgPat has two constructors: VisPat for
common patterns and InvisPat for @-patterns.
Parsing is implemented in production argpat. Was introduced
ArgPatBuilder to help post process new patterns.
Renaming of ArgPat is implemented in rnArgPats function.
Type checking is a bit tricky due to eager scolemisation.
It's implemented in new functions tcTopSkolemiseExpPatTys,
tcSkolemiseScopedExpPatTys, and tcArgPats. For more information
about hack with collecting `ExpPatType`s see Note
[Type-checking invisible type patterns: check mode]
Type-checking is currently limited by check mode and -XNoDeepSubsumption.
Examples of new code:
id1 :: forall a. a -> a
id1 @t x = x :: t
id2 :: a -> a
id2 @t x = x :: t
id3 :: a -> a
id3 = \ @t x -> x
id_RankN :: (forall a. a -> a) -> a -> a
id_RankN @t f = f @t
id4 = id_RankN \ @t x -> x :: t
id_list :: [forall a. a -> a]
id_list = [\ @t x -> x]
Metric Increase:
LargeRecord
RecordUpdPerf
- - - - -
30 changed files:
- compiler/GHC/Builtin/Names/TH.hs
- compiler/GHC/Hs/Expr.hs
- compiler/GHC/Hs/Instances.hs
- compiler/GHC/Hs/Pat.hs
- compiler/GHC/Hs/Utils.hs
- compiler/GHC/HsToCore/Arrows.hs
- compiler/GHC/HsToCore/Match.hs
- compiler/GHC/HsToCore/Pmc/Desugar.hs
- compiler/GHC/HsToCore/Quote.hs
- compiler/GHC/HsToCore/Ticks.hs
- compiler/GHC/HsToCore/Utils.hs
- compiler/GHC/Iface/Ext/Ast.hs
- compiler/GHC/Parser.y
- compiler/GHC/Parser/PostProcess.hs
- compiler/GHC/Rename/Bind.hs
- compiler/GHC/Rename/HsType.hs
- compiler/GHC/Rename/Pat.hs
- compiler/GHC/Rename/Utils.hs
- compiler/GHC/Tc/Deriv/Functor.hs
- compiler/GHC/Tc/Deriv/Generate.hs
- compiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Errors/Types.hs
- compiler/GHC/Tc/Gen/App.hs
- compiler/GHC/Tc/Gen/Arrow.hs
- compiler/GHC/Tc/Gen/Bind.hs
- compiler/GHC/Tc/Gen/Expr.hs
- compiler/GHC/Tc/Gen/Expr.hs-boot
- compiler/GHC/Tc/Gen/Head.hs
- compiler/GHC/Tc/Gen/Match.hs
- compiler/GHC/Tc/Gen/Match.hs-boot
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/ca8c4869a22c678f81231cfa49cd82ec2fc84ee8...69b07bc378df60304b96aeccbb41a007bb07992b
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/ca8c4869a22c678f81231cfa49cd82ec2fc84ee8...69b07bc378df60304b96aeccbb41a007bb07992b
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/20231215/599a4dcb/attachment.html>
More information about the ghc-commits
mailing list