[Git][ghc/ghc][wip/T16432] 7 commits: Data.Bag: add INLINEABLE to polymorphic functions

Krzysztof Gogolewski (@monoidal) gitlab at gitlab.haskell.org
Wed May 31 21:13:26 UTC 2023



Krzysztof Gogolewski pushed to branch wip/T16432 at Glasgow Haskell Compiler / GHC


Commits:
d56dd695 by sheaf at 2023-05-31T11:37:12-04:00
Data.Bag: add INLINEABLE to polymorphic functions

This commit allows polymorphic methods in GHC.Data.Bag to be
specialised, avoiding having to pass explicit dictionaries when they
are instantiated with e.g. a known monad.

- - - - -
5366cd35 by sheaf at 2023-05-31T11:37:12-04:00
Split off TcBinderStack into its own module

This commit splits off TcBinderStack into its own module,
to avoid module cycles: we might want to refer to it without also
pulling in the TcM monad.

- - - - -
09d4d307 by sheaf at 2023-05-31T11:37:12-04:00
Split off TcRef into its own module

This helps avoid pull in the full TcM monad when we just want access
to mutable references in the typechecker. This facilitates later patches
which introduce a slimmed down TcM monad for zonking.

- - - - -
88cc19b3 by sheaf at 2023-05-31T11:37:12-04:00
Introduce Codensity monad

The Codensity monad is useful to write state-passing computations in
continuation-passing style, e.g. to implement a State monad as
continuation-passing style over a Reader monad.

- - - - -
f62d8195 by sheaf at 2023-05-31T11:37:12-04:00
Restructure the zonker

This commit splits up the zonker into a few separate components, described
in Note [The structure of the zonker] in `GHC.Tc.Zonk.Type`.

1. `GHC.Tc.Zonk.Monad` introduces a pared-down `TcM` monad, `ZonkM`,
     which has enough information for zonking types.
     This allows us to refactor `ErrCtxt` to use `ZonkM` instead of `TcM`,
     which guarantees we don't throw an error while reporting an error.

2. `GHC.Tc.Zonk.Env` is the new home of `ZonkEnv`, and also defines
    two zonking monad transformers, `ZonkT` and `ZonkBndrT`.
    `ZonkT` is a reader monad transformer over `ZonkEnv`.
    `ZonkBndrT m` is the codensity monad over `ZonkT m`.

     `ZonkBndrT` is used for computations that accumulate binders
     in the `ZonkEnv`.

3. `GHC.Tc.Zonk.TcType` contains the code for zonking types, for use
    in the typechecker. It uses the `ZonkM` monad.

4. `GHC.Tc.Zonk.Type` contains the code for final zonking to `Type`,
    which has been refactored to use `ZonkTcM = ZonkT TcM` and
    `ZonkBndrTcM = ZonkBndrT TcM`.

Allocations slightly decrease on the whole due to using
continuation-passing style instead of manual state passing of ZonkEnv
in the final zonking to Type.

-------------------------
Metric Decrease:
    T4029
    T8095
    T14766
    T15304
    hard_hole_fits
    RecordUpdPerf
Metric Increase:
    T10421
-------------------------

- - - - -
70526f5b by mimi.vx at 2023-05-31T11:37:53-04:00
Update rdt-theme to latest upstream version

Fixes https://gitlab.haskell.org/ghc/ghc/-/issues/23444

- - - - -
11e385d4 by Krzysztof Gogolewski at 2023-05-31T23:12:23+02:00
Add testcases for already fixed #16432

They were fixed by 40c7daed0.

Fixes #16432

- - - - -


30 changed files:

- compiler/GHC/Core/Type.hs
- compiler/GHC/CoreToStg/Prep.hs
- compiler/GHC/Data/Bag.hs
- compiler/GHC/Data/IOEnv.hs
- compiler/GHC/Driver/Main.hs
- compiler/GHC/Hs/Utils.hs
- compiler/GHC/HsToCore/Binds.hs
- compiler/GHC/HsToCore/Expr.hs
- compiler/GHC/HsToCore/Match/Literal.hs
- compiler/GHC/HsToCore/Pmc/Desugar.hs
- compiler/GHC/Rename/Env.hs
- compiler/GHC/Rename/Names.hs
- compiler/GHC/Rename/Pat.hs
- compiler/GHC/Rename/Splice.hs
- compiler/GHC/Runtime/Eval.hs
- compiler/GHC/Runtime/Heap/Inspect.hs
- compiler/GHC/Tc/Deriv/Generate.hs
- compiler/GHC/Tc/Deriv/Infer.hs
- compiler/GHC/Tc/Deriv/Utils.hs
- compiler/GHC/Tc/Errors.hs
- compiler/GHC/Tc/Errors/Hole.hs
- compiler/GHC/Tc/Errors/Hole.hs-boot
- compiler/GHC/Tc/Errors/Ppr.hs
- compiler/GHC/Tc/Errors/Types.hs
- compiler/GHC/Tc/Gen/App.hs
- compiler/GHC/Tc/Gen/Bind.hs
- compiler/GHC/Tc/Gen/Default.hs
- compiler/GHC/Tc/Gen/Expr.hs
- compiler/GHC/Tc/Gen/Foreign.hs
- compiler/GHC/Tc/Gen/Head.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/961b8ce3efaf2f2db032c63f608788bf0940059f...11e385d4e7b99d4e0957531b030dae60a3b721f5

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/961b8ce3efaf2f2db032c63f608788bf0940059f...11e385d4e7b99d4e0957531b030dae60a3b721f5
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/20230531/2225286b/attachment-0001.html>


More information about the ghc-commits mailing list