Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • ghc/ghc
  • bgamari/ghc
  • syd/ghc
  • ggreif/ghc
  • watashi/ghc
  • RolandSenn/ghc
  • mpickering/ghc
  • DavidEichmann/ghc
  • carter/ghc
  • harpocrates/ghc
  • ethercrow/ghc
  • mijicd/ghc
  • adamse/ghc
  • alexbiehl/ghc
  • gridaphobe/ghc
  • trofi/ghc
  • supersven/ghc
  • ppk/ghc
  • ulysses4ever/ghc
  • AndreasK/ghc
  • ghuntley/ghc
  • shayne-fletcher-da/ghc
  • fgaz/ghc
  • yav/ghc
  • osa1/ghc
  • mbbx6spp/ghc
  • JulianLeviston/ghc
  • reactormonk/ghc
  • rae/ghc
  • takenobu-hs/ghc
  • michalt/ghc
  • andrewthad/ghc
  • hsyl20/ghc
  • scottgw/ghc
  • sjakobi/ghc
  • angerman/ghc
  • RyanGlScott/ghc
  • hvr/ghc
  • howtonotwin/ghc
  • chessai/ghc
  • m-renaud/ghc
  • brprice/ghc
  • stevehartdata/ghc
  • sighingnow/ghc
  • kgardas/ghc
  • ckoparkar/ghc
  • alp/ghc
  • smaeul/ghc
  • kakkun61/ghc
  • sykloid/ghc
  • newhoggy/ghc
  • toonn/ghc
  • nineonine/ghc
  • Phyx/ghc
  • ezyang/ghc
  • tweag/ghc
  • langston/ghc
  • ndmitchell/ghc
  • rockbmb/ghc
  • artempyanykh/ghc
  • mniip/ghc
  • mynguyenbmc/ghc
  • alexfmpe/ghc
  • crockeea/ghc
  • nh2/ghc
  • vaibhavsagar/ghc
  • phadej/ghc
  • Haskell-mouse/ghc
  • lolotp/ghc
  • spacekitteh/ghc
  • michaelpj/ghc
  • mgsloan/ghc
  • HPCohen/ghc
  • tmobile/ghc
  • radrow/ghc
  • simonmar/ghc
  • _deepfire/ghc
  • Ericson2314/ghc
  • leitao/ghc
  • fumieval/ghc
  • trac-isovector/ghc
  • cblp/ghc
  • xich/ghc
  • ciil/ghc
  • erthalion/ghc
  • xldenis/ghc
  • autotaker/ghc
  • haskell-wasm/ghc
  • kcsongor/ghc
  • agander/ghc
  • Baranowski/ghc
  • trac-dredozubov/ghc
  • 23Skidoo/ghc
  • iustin/ghc
  • ningning/ghc
  • josefs/ghc
  • kabuhr/ghc
  • gallais/ghc
  • dten/ghc
  • expipiplus1/ghc
  • Pluralia/ghc
  • rohanjr/ghc
  • intricate/ghc
  • kirelagin/ghc
  • Javran/ghc
  • DanielG/ghc
  • trac-mizunashi_mana/ghc
  • pparkkin/ghc
  • bollu/ghc
  • ntc2/ghc
  • jaspervdj/ghc
  • JoshMeredith/ghc
  • wz1000/ghc
  • zkourouma/ghc
  • code5hot/ghc
  • jdprice/ghc
  • tdammers/ghc
  • J-mie6/ghc
  • trac-lantti/ghc
  • ch1bo/ghc
  • cgohla/ghc
  • lucamolteni/ghc
  • acairncross/ghc
  • amerocu/ghc
  • chreekat/ghc
  • txsmith/ghc
  • trupill/ghc
  • typetetris/ghc
  • sergv/ghc
  • fryguybob/ghc
  • erikd/ghc
  • trac-roland/ghc
  • setupminimal/ghc
  • Friede80/ghc
  • SkyWriter/ghc
  • xplorld/ghc
  • abrar/ghc
  • obsidiansystems/ghc
  • Icelandjack/ghc
  • adinapoli/ghc
  • trac-matthewbauer/ghc
  • heatsink/ghc
  • dwijnand/ghc
  • Cmdv/ghc
  • alinab/ghc
  • pepeiborra/ghc
  • fommil/ghc
  • luochen1990/ghc
  • rlupton20/ghc
  • applePrincess/ghc
  • lehins/ghc
  • ronmrdechai/ghc
  • leeadam/ghc
  • harendra/ghc
  • mightymosquito1991/ghc
  • trac-gershomb/ghc
  • lucajulian/ghc
  • Rizary/ghc
  • VictorCMiraldo/ghc
  • jamesbrock/ghc
  • andrewdmeier/ghc
  • luke/ghc
  • pranaysashank/ghc
  • cocreature/ghc
  • hithroc/ghc
  • obreitwi/ghc
  • slrtbtfs/ghc
  • kaol/ghc
  • yairchu/ghc
  • Mathemagician98/ghc
  • trac-taylorfausak/ghc
  • leungbk/ghc
  • MichaWiedenmann/ghc
  • chris-martin/ghc
  • TDecki/ghc
  • adithyaov/ghc
  • trac-gelisam/ghc
  • Lysxia/ghc
  • complyue/ghc
  • bwignall/ghc
  • sternmull/ghc
  • sonika/ghc
  • leif/ghc
  • broadwaylamb/ghc
  • myszon/ghc
  • danbroooks/ghc
  • Mechachleopteryx/ghc
  • zardyh/ghc
  • trac-vdukhovni/ghc
  • OmarKhaledAbdo/ghc
  • arrowd/ghc
  • Bodigrim/ghc
  • matheus23/ghc
  • cardenaso11/ghc
  • trac-Athas/ghc
  • mb720/ghc
  • DylanZA/ghc
  • liff/ghc
  • typedrat/ghc
  • trac-claude/ghc
  • jbm/ghc
  • Gertjan423/ghc
  • PHO/ghc
  • JKTKops/ghc
  • kockahonza/ghc
  • msakai/ghc
  • Sir4ur0n/ghc
  • barambani/ghc
  • vishnu.c/ghc
  • dcoutts/ghc
  • trac-runeks/ghc
  • trac-MaxGabriel/ghc
  • lexi.lambda/ghc
  • strake/ghc
  • spavikevik/ghc
  • JakobBruenker/ghc
  • rmanne/ghc
  • gdziadkiewicz/ghc
  • ani/ghc
  • iliastsi/ghc
  • smunix/ghc
  • judah/ghc
  • blackgnezdo/ghc
  • emilypi/ghc
  • trac-bpfoley/ghc
  • muesli4/ghc
  • trac-gkaracha/ghc
  • Kleidukos/ghc
  • nek0/ghc
  • TristanCacqueray/ghc
  • dwulive/ghc
  • mbakke/ghc
  • arybczak/ghc
  • Yang123321/ghc
  • maksbotan/ghc
  • QuietMisdreavus/ghc
  • trac-olshanskydr/ghc
  • emekoi/ghc
  • samuela/ghc
  • josephcsible/ghc
  • dramforever/ghc
  • lpsmith/ghc
  • DenisFrezzato/ghc
  • michivi/ghc
  • jneira/ghc
  • jeffhappily/ghc
  • Ivan-Yudin/ghc
  • nakaji-dayo/ghc
  • gdevanla/ghc
  • galen/ghc
  • fendor/ghc
  • yaitskov/ghc
  • rcythr/ghc
  • awpr/ghc
  • jeremyschlatter/ghc
  • Aver1y/ghc
  • mitchellvitez/ghc
  • merijn/ghc
  • tomjaguarpaw1/ghc
  • trac-NoidedSuper/ghc
  • erewok/ghc
  • trac-junji.hashimoto/ghc
  • adamwespiser/ghc
  • bjaress/ghc
  • jhrcek/ghc
  • leonschoorl/ghc
  • lukasz-golebiewski/ghc
  • sheaf/ghc
  • last-g/ghc
  • carassius1014/ghc
  • eschwartz/ghc
  • dwincort/ghc
  • felixwiemuth/ghc
  • TimWSpence/ghc
  • marcusmonteirodesouza/ghc
  • WJWH/ghc
  • vtols/ghc
  • theobat/ghc
  • BinderDavid/ghc
  • ckoparkar0/ghc
  • alexander-kjeldaas/ghc
  • dme2/ghc
  • philderbeast/ghc
  • aaronallen8455/ghc
  • rayshih/ghc
  • benkard/ghc
  • mpardalos/ghc
  • saidelman/ghc
  • leiftw/ghc
  • ca333/ghc
  • bwroga/ghc
  • nmichael44/ghc
  • trac-crobbins/ghc
  • felixonmars/ghc
  • adityagupta1089/ghc
  • hgsipiere/ghc
  • treeowl/ghc
  • alexpeits/ghc
  • CraigFe/ghc
  • dnlkrgr/ghc
  • kerckhove_ts/ghc
  • cptwunderlich/ghc
  • eiais/ghc
  • hahohihu/ghc
  • sanchayan/ghc
  • lemmih/ghc
  • sehqlr/ghc
  • trac-dbeacham/ghc
  • luite/ghc
  • trac-f-a/ghc
  • vados/ghc
  • luntain/ghc
  • fatho/ghc
  • alexbiehl-gc/ghc
  • dcbdan/ghc
  • tvh/ghc
  • liam-ly/ghc
  • timbobbarnes/ghc
  • GovanifY/ghc
  • shanth2600/ghc
  • gliboc/ghc
  • duog/ghc
  • moxonsghost/ghc
  • zander/ghc
  • masaeedu/ghc
  • georgefst/ghc
  • guibou/ghc
  • nicuveo/ghc
  • mdebruijne/ghc
  • stjordanis/ghc
  • emiflake/ghc
  • wygulmage/ghc
  • frasertweedale/ghc
  • coot/ghc
  • aratamizuki/ghc
  • tsandstr/ghc
  • mrBliss/ghc
  • Anton-Latukha/ghc
  • tadfisher/ghc
  • vapourismo/ghc
  • Sorokin-Anton/ghc
  • basile-henry/ghc
  • trac-mightybyte/ghc
  • AbsoluteNikola/ghc
  • cobrien99/ghc
  • songzh/ghc
  • blamario/ghc
  • aj4ayushjain/ghc
  • trac-utdemir/ghc
  • tangcl/ghc
  • hdgarrood/ghc
  • maerwald/ghc
  • arjun/ghc
  • ratherforky/ghc
  • haskieLambda/ghc
  • EmilGedda/ghc
  • Bogicevic/ghc
  • eddiejessup/ghc
  • kozross/ghc
  • AlistairB/ghc
  • 3Rafal/ghc
  • christiaanb/ghc
  • trac-bit/ghc
  • matsumonkie/ghc
  • trac-parsonsmatt/ghc
  • chisui/ghc
  • jaro/ghc
  • trac-kmiyazato/ghc
  • davidsd/ghc
  • Tritlo/ghc
  • I-B-3/ghc
  • lykahb/ghc
  • AriFordsham/ghc
  • turion1/ghc
  • berberman/ghc
  • christiantakle/ghc
  • zyklotomic/ghc
  • trac-ocramz/ghc
  • CSEdd/ghc
  • doyougnu/ghc
  • mmhat/ghc
  • why-not-try-calmer/ghc
  • plutotulp/ghc
  • kjekac/ghc
  • Manvi07/ghc
  • teo/ghc
  • cactus/ghc
  • CarrieMY/ghc
  • abel/ghc
  • yihming/ghc
  • tsakki/ghc
  • jessicah/ghc
  • oliverbunting/ghc
  • meld/ghc
  • friedbrice/ghc
  • Joald/ghc
  • abarbu/ghc
  • DigitalBrains1/ghc
  • sterni/ghc
  • alexDarcy/ghc
  • hexchain/ghc
  • minimario/ghc
  • zliu41/ghc
  • tommd/ghc
  • jazcarate/ghc
  • peterbecich/ghc
  • alirezaghey/ghc
  • solomon/ghc
  • mikael.urankar/ghc
  • davjam/ghc
  • int-index/ghc
  • MorrowM/ghc
  • nrnrnr/ghc
  • Sonfamm/ghc-test-only
  • afzt1/ghc
  • nguyenhaibinh-tpc/ghc
  • trac-lierdakil/ghc
  • MichaWiedenmann1/ghc
  • jmorag/ghc
  • Ziharrk/ghc
  • trac-MitchellSalad/ghc
  • juampe/ghc
  • jwaldmann/ghc
  • snowleopard/ghc
  • juhp/ghc
  • normalcoder/ghc
  • ksqsf/ghc
  • trac-jberryman/ghc
  • roberth/ghc
  • 1ntEgr8/ghc
  • epworth/ghc
  • MrAdityaAlok/ghc
  • JunmingZhao42/ghc
  • jappeace/ghc
  • trac-Gabriel439/ghc
  • alt-romes/ghc
  • HugoPeters1024/ghc
  • 10ne1/ghc-fork
  • agentultra/ghc
  • Garfield1002/ghc
  • ChickenProp/ghc
  • clyring/ghc
  • MaxHearnden/ghc
  • jumper149/ghc
  • vem/ghc
  • ketzacoatl/ghc
  • Rosuavio/ghc
  • jackohughes/ghc
  • p4l1ly/ghc
  • konsumlamm/ghc
  • shlevy/ghc
  • torsten.schmits/ghc
  • andremarianiello/ghc
  • amesgen/ghc
  • googleson78/ghc
  • InfiniteVerma/ghc
  • uhbif19/ghc
  • yiyunliu/ghc
  • raehik/ghc
  • mrkun/ghc
  • telser/ghc
  • 1Jajen1/ghc
  • slotThe/ghc
  • WinstonHartnett/ghc
  • mpilgrem/ghc
  • dreamsmasher/ghc
  • schuelermine/ghc
  • trac-Viwor/ghc
  • undergroundquizscene/ghc
  • evertedsphere/ghc
  • coltenwebb/ghc
  • oberblastmeister/ghc
  • agrue/ghc
  • lf-/ghc
  • zacwood9/ghc
  • steshaw/ghc
  • high-cloud/ghc
  • SkamDart/ghc
  • PiDelport/ghc
  • maoif/ghc
  • RossPaterson/ghc
  • CharlesTaylor7/ghc
  • ribosomerocker/ghc
  • trac-ramirez7/ghc
  • daig/ghc
  • NicolasT/ghc
  • FinleyMcIlwaine/ghc
  • lawtonnichols/ghc
  • jmtd/ghc
  • ozkutuk/ghc
  • wildsebastian/ghc
  • nikshalark/ghc
  • lrzlin/ghc
  • tobias/ghc
  • fw/ghc
  • hawkinsw/ghc
  • type-dance/ghc
  • rui314/ghc
  • ocharles/ghc
  • wavewave/ghc
  • TheKK/ghc
  • nomeata/ghc
  • trac-csabahruska/ghc
  • jonathanjameswatson/ghc
  • L-as/ghc
  • Axman6/ghc
  • barracuda156/ghc
  • trac-jship/ghc
  • jake-87/ghc
  • meooow/ghc
  • rebeccat/ghc
  • hamana55/ghc
  • Enigmage/ghc
  • kokobd/ghc
  • agevelt/ghc
  • gshen42/ghc
  • chrismwendt/ghc
  • MangoIV/ghc
  • teto/ghc
  • Sookr1/ghc
  • trac-thomasjm/ghc
  • barci2/ghc-dev
  • trac-m4dc4p/ghc
  • dixonary/ghc
  • breakerzirconia/ghc
  • alexsio27444/ghc
  • glocq/ghc
  • sourabhxyz/ghc
  • ryantrinkle/ghc
  • Jade/ghc
  • scedfaliako/ghc
  • martijnbastiaan/ghc
  • trac-george.colpitts/ghc
  • ammarbinfaisal/ghc
  • mimi.vx/ghc
  • lortabac/ghc
  • trac-zyla/ghc
  • benbellick/ghc
  • aadaa-fgtaa/ghc
  • jvanbruegge/ghc
  • archbung/ghc
  • gilmi/ghc
  • mfonism/ghc
  • alex-mckenna/ghc
  • Ei30metry/ghc
  • DiegoDiverio/ghc
  • jorgecunhamendes/ghc
  • liesnikov/ghc
  • akrmn/ghc
  • trac-simplifierticks/ghc
  • jacco/ghc
  • rhendric/ghc
  • damhiya/ghc
  • ryndubei/ghc
  • DaveBarton/ghc
  • trac-Profpatsch/ghc
  • GZGavinZhao/ghc
  • ncfavier/ghc
  • jameshaydon/ghc
  • ajccosta/ghc
  • dschrempf/ghc
  • cydparser/ghc
  • LinuxUserGD/ghc
  • elodielander/ghc
  • facundominguez/ghc
  • psilospore/ghc
  • lachrimae/ghc
  • dylan-thinnes/ghc-type-errors-plugin
  • hamishmack/ghc
  • Leary/ghc
  • lzszt/ghc
  • lyokha/ghc
  • trac-glaubitz/ghc
  • Rewbert/ghc
  • andreabedini/ghc
  • Jasagredo/ghc
  • sol/ghc
  • OlegAlexander/ghc
  • trac-sthibaul/ghc
  • avdv/ghc
  • Wendaolee/ghc
  • ur4t/ghc
  • daylily/ghc
  • boltzmannrain/ghc
  • mmzk1526/ghc
  • trac-fizzixnerd/ghc
  • soulomoon/ghc
  • rwmjones/ghc
  • j14i/ghc
  • tracsis/ghc
  • gesh/ghc
  • flip101/ghc
  • eldritch-cookie/ghc
  • LemonjamesD/ghc
  • pgujjula/ghc
  • skeuchel/ghc
  • noteed/ghc
  • gulin.serge/ghc
  • Torrekie/ghc
  • jlwoodwa/ghc
  • ayanamists/ghc
  • husong998/ghc
  • trac-edmundnoble/ghc
  • josephf/ghc
  • contrun/ghc
  • baulig/ghc
  • edsko/ghc
  • mzschr/ghc-issue-24732
  • ulidtko/ghc
  • Arsen/ghc
  • trac-sjoerd_visscher/ghc
  • crumbtoo/ghc
  • L0neGamer/ghc
  • DrewFenwick/ghc
  • benz0li/ghc
  • MaciejWas/ghc
  • jordanrule/ghc
  • trac-qqwy/ghc
  • LiamGoodacre/ghc
  • isomorpheme/ghc
  • trac-danidiaz/ghc
  • Kariim/ghc
  • MTaimoorZaeem/ghc
  • hololeap/ghc
  • ticat-fp/ghc
  • meritamen/ghc
  • criskell/ghc
  • trac-kraai/ghc
  • aergus/ghc
  • jdral/ghc
  • SamB/ghc
  • Tristian/ghc
  • ywgrit/ghc
  • KatsuPatrick/ghc
  • OsePedro/ghc
  • mpscholten/ghc
  • fp/ghc
  • zaquest/ghc
  • fangyi-zhou/ghc
  • augyg/ghc
640 results
Show changes
Commits on Source (29)
  • Pierre Le Marre's avatar
    ucd2haskell: remove Streamly dependency + misc · 7b23ce8b
    Pierre Le Marre authored and Marge Bot's avatar Marge Bot committed
    - Remove dead code.
    - Remove `streamly` dependency.
    - Process files with `bytestring`.
    - Replace Unicode files parsers with the corresponding ones from the
      package `unicode-data-parser`.
    - Simplify cabal file and rename module
    - Regenerate `ghc-internal` Unicode files with new header
    7b23ce8b
  • Jacco Krijnen's avatar
    Document how to run haddocks tests (#24976) · 4570319f
    Jacco Krijnen authored and Marge Bot's avatar Marge Bot committed
    Also remove ghc 9.7 requirement
    4570319f
  • amesgen's avatar
    compiler: refactor lower_CmmExpr_Ptr · fb629e24
    amesgen authored and Marge Bot's avatar Marge Bot committed
    fb629e24
  • amesgen's avatar
    compiler: handle CmmRegOff in lower_CmmExpr_Ptr · def46c8c
    amesgen authored and Marge Bot's avatar Marge Bot committed
    def46c8c
  • Simon Peyton Jones's avatar
    Small documentation update in Quick Look · ce76bf78
    Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
    ce76bf78
  • Simon Peyton Jones's avatar
    Add hack for #24623 · 19bcfc9b
    Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
    ..Th bug in #24623 is randomly triggered by this MR!..
    19bcfc9b
  • Simon Peyton Jones's avatar
    Various fixes to type-tidying · 7a08a025
    Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
    This MR was triggered by #24868, but I found a number of bugs
    and infelicities in type-tidying as I went along.  Highlights:
    
    * Fix to #24868 is in GHC.Tc.Errors.report_unsolved: avoid
      using the OccNames of /bound/ variables when tidying /free/
      variables; see the call to `tidyAvoiding`.  That avoid the
      gratuitous renaming which was the cause of #24868. See
         Note [tidyAvoiding] in GHC.Core.TyCo.Tidy
    
    * Refactor and document the tidying of open types.
      See GHC.Core.TyCo.Tidy
         Note [Tidying open types]
         Note [Tidying is idempotent]
    
    * Tidy the coercion variable in HoleCo. That's important so
      that tidied types have tidied kinds.
    
    * Some small renaming to make things consistent.  In particular
      the "X" forms return a new TidyEnv.  E.g.
         tidyOpenType  :: TidyEnv -> Type -> Type
         tidyOpenTypeX :: TidyEnv -> Type -> (TidyEnv, Type)
    7a08a025
  • Simon Peyton Jones's avatar
    Wibble · 2eac0288
    Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
    2eac0288
  • Simon Peyton Jones's avatar
    Wibbles · e5d24cc2
    Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
    e5d24cc2
  • Simon Peyton Jones's avatar
    Localise a case-binder in SpecConstr.mkSeqs · 246bc3a4
    Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
    This small change fixes #24944
    
    See (SCF1) in Note [SpecConstr and strict fields]
    246bc3a4
  • Sylvain Henry's avatar
    PPC: display foreign label in panic message (cf #23969) · a5994380
    Sylvain Henry authored and Marge Bot's avatar Marge Bot committed
    a5994380
  • Rodrigo Mesquita's avatar
    cmm: Parse MO_BSwap primitive operation · bd95553a
    Rodrigo Mesquita authored and Marge Bot's avatar Marge Bot committed
    Parsing this operation allows it to be tested using `test-primops` in a
    subsequent MR.
    bd95553a
  • Bodigrim's avatar
  • Alan Zimmerman's avatar
    EPA: Add location to Match Pats list · 118a1292
    Alan Zimmerman authored and Marge Bot's avatar Marge Bot committed
    So we can freely modify the pats and the following item spacing will
    still be valid when exact printing.
    
    Closes #24862
    118a1292
  • Fabricio de Sousa Nascimento's avatar
    compiler: Rejects RULES whose LHS immediately fails to type-check · db343324
    Fabricio de Sousa Nascimento authored and Marge Bot's avatar Marge Bot committed
    Fixes GHC crashing on `decomposeRuleLhs` due to ignoring coercion values. This
    happens when we have a RULE that does not type check, and enable
    `-fdefer-type-errors`. We prevent this to happen by rejecting RULES with an
    immediately LHS type error.
    
    Fixes #24026
    db343324
  • Dylan Thinnes's avatar
    Add hscTypecheckRenameWithDiagnostics, for HLS (#24996) · e7a95662
    Dylan Thinnes authored and Marge Bot's avatar Marge Bot committed
    Use runHsc' in runHsc so that both functions can't fall out of sync
    
    We're currently copying parts of GHC code to get structured warnings
    in HLS, so that we can recreate `hscTypecheckRenameWithDiagnostics`
    locally. Once we get this function into GHC we can drop the copied code
    in future versions of HLS.
    e7a95662
  • sheaf's avatar
    Clarify -XGADTs enables existential quantification · d70abb49
    sheaf authored and Marge Bot's avatar Marge Bot committed
    Even though -XGADTs does not turn on -XExistentialQuantification,
    it does allow the user of existential quantification syntax, without
    needing to use GADT-style syntax.
    
    Fixes #20865
    d70abb49
  • BinderDavid's avatar
    Add RTS flag --read-tix-file (GHC Proposal 612) · 13fdf788
    BinderDavid authored and Marge Bot's avatar Marge Bot committed
    This commit introduces the RTS flag `--read-tix-file=<yes|no>` which
    controls whether a preexisting .tix file is read in at the beginning
    of a program run. The default is currently `--read-tix-file=yes` but
    will change to `--read-tix-file=no` in a future release of GHC. For
    this reason, whenever a .tix file is read in a warning is emitted to
    stderr. This warning can be silenced by explicitly passing the
    `--read-tix-file=yes` option. Details can be found in the GHC proposal
    cited below.
    
    Users can query whether this flag has been used with the help of the
    module `GHC.RTS.Flags`. A new field `readTixFile` was added to the
    record `HpcFlags`.
    
    These changes have been discussed and approved in
    - GHC proposal 612: https://github.com/ghc-proposals/ghc-proposals/pull/612
    - CLC proposal 276: https://github.com/haskell/core-libraries-committee/issues/276
    13fdf788
  • Hannes Siebenhandl's avatar
    Improve sharing of duplicated values in `ModIface`, fixes #24723 · f0e3cb6a
    Hannes Siebenhandl authored and Marge Bot's avatar Marge Bot committed
    As a `ModIface` often contains duplicated values that are not
    necessarily shared, we improve sharing by serialising the `ModIface`
    to an in-memory byte array. Serialisation uses deduplication tables, and
    deserialisation implicitly shares duplicated values.
    
    This helps reducing the peak memory usage while compiling in
    `--make` mode. The peak memory usage is especially smaller when
    generating interface files with core expressions
    (`-fwrite-if-simplified-core`).
    
    On agda, this reduces the peak memory usage:
    
    * `2.2 GB` to `1.9 GB` for a ghci session.
    
    On `lib:Cabal`, we report:
    
    * `570 MB` to `500 MB` for a ghci session
    * `790 MB` to `667 MB` for compiling `lib:Cabal` with ghc
    
    There is a small impact on execution time, around 2% on the agda code
    base.
    f0e3cb6a
  • Hannes Siebenhandl's avatar
    Avoid unneccessarily re-serialising the `ModIface` · 1bab7dde
    Hannes Siebenhandl authored and Marge Bot's avatar Marge Bot committed
    To reduce memory usage of `ModIface`, we serialise `ModIface` to an
    in-memory byte array, which implicitly shares duplicated values.
    
    This serialised byte array can be reused to avoid work when we actually
    write the `ModIface` to disk.
    We introduce a new field to `ModIface` which allows us to save the byte
    array, and write it direclty to disk if the `ModIface` wasn't changed
    after the initial serialisation.
    
    This requires us to change absolute offsets, for example to jump to the
    deduplication table for `Name` or `FastString` with relative offsets, as
    the deduplication byte array doesn't contain header information, such as
    fingerprints.
    To allow us to dump the binary blob to disk, we need to replace all
    absolute offsets with relative ones.
    
    We introduce additional helpers for `ModIface` binary serialisation, which
    construct relocatable binary blobs. We say the binary blob is relocatable,
    if the binary representation can be moved and does not contain any
    absolute offsets.
    
    Further, we introduce new primitives for `Binary` that allow to create
    relocatable binaries, such as `forwardGetRel` and `forwardPutRel`.
    
    -------------------------
    Metric Decrease:
        MultiLayerModulesDefsGhcWithCore
    Metric Increase:
        MultiComponentModules
        MultiLayerModules
        T10421
        T12150
        T12234
        T12425
        T13035
        T13253-spj
        T13701
        T13719
        T14697
        T15703
        T16875
        T18698b
        T18140
        T18304
        T18698a
        T18730
        T18923
        T20049
        T24582
        T5837
        T6048
        T9198
        T9961
        mhu-perf
    -------------------------
    
    These metric increases may look bad, but they are all completely benign,
    we simply allocate 1 MB per module for `shareIface`. As this allocation
    is quite quick, it has a negligible impact on run-time performance.
    In fact, the performance difference wasn't measurable on my local
    machine. Reducing the size of the pre-allocated 1 MB buffer avoids these
    test failures, but also requires us to reallocate the buffer if the
    interface file is too big. These reallocations *did* have an impact on
    performance, which is why I have opted to accept all these metric
    increases, as the number of allocated bytes is merely a guidance.
    
    This 1MB allocation increase causes a lot of tests to fail that
    generally have a low allocation number. E.g., increasing from 40MB to
    41MB is a 2.5% increase.
    In particular, the tests T12150, T13253-spj, T18140, T18304, T18698a,
    T18923, T20049, T24582, T5837, T6048, and T9961 only fail on i386-darwin
    job, where the number of allocated bytes seems to be lower than in other
    jobs.
    The tests T16875 and T18698b fail on i386-linux for the same reason.
    1bab7dde
  • Andreas Klebinger's avatar
    Improve documentation of @Any@ type. · 099992df
    Andreas Klebinger authored and Marge Bot's avatar Marge Bot committed
    In particular mention possible uses for non-lifted types.
    
    Fixes #23100.
    099992df
  • Jakob Brünker's avatar
    Update user guide to indicate support for 64-tuples · 5e75412b
    Jakob Brünker authored and Marge Bot's avatar Marge Bot committed
    5e75412b
  • Andreas Klebinger's avatar
    lint notes: Add more info to notes.stdout · 4f5da595
    Andreas Klebinger authored and Marge Bot's avatar Marge Bot committed
    When fixing a note reference CI fails with a somewhat confusing diff.
    See #21123. This commit adds a line to the output file being compared
    which hopefully makes it clear this is the list of broken refs, not all
    refs.
    
    Fixes #21123
    4f5da595
  • Jakob Brünker's avatar
    docs: Update mention of ($) type in user guide · 1eb15c61
    Jakob Brünker authored and Marge Bot's avatar Marge Bot committed
    Fixes #24909
    1eb15c61
  • Jan Hrček's avatar
    Remove duplicate Anno instances · 1d66c9e3
    Jan Hrček authored and Marge Bot's avatar Marge Bot committed
    1d66c9e3
  • Sven Tennie's avatar
    AArch64: Delete unused RegNos · 8ea0ba95
    Sven Tennie authored and Marge Bot's avatar Marge Bot committed
    This has the additional benefit of getting rid of the -1 encoding (real
    registers start at 0.)
    8ea0ba95
  • Sjoerd Visscher's avatar
    Bump stm submodule to current master · 325422e0
    Sjoerd Visscher authored and Marge Bot's avatar Marge Bot committed
    325422e0
  • Cheng Shao's avatar
    testsuite: bump T17572 timeout on wasm32 · 64fba310
    Cheng Shao authored and Marge Bot's avatar Marge Bot committed
    64fba310
  • Simon Peyton Jones's avatar
    Fix demand signatures for join points · a96cc423
    Simon Peyton Jones authored
    This MR tackles #24623 and #23113
    
    The main change is to give a clearer notion of "worker/wrapper arity", esp
    for join points. See GHC.Core.Opt.DmdAnal
         Note [Worker/wrapper arity and join points]
    This Note is a good summary of what this MR does:
    
    (1) The "worker/wrapper arity" of an Id is
        * For non-join-points: idArity
        * The join points: the join arity (Id part only of course)
        This is the number of args we will use in worker/wrapper.
        See `ww_arity` in `dmdAnalRhsSig`, and the function `workWrapArity`.
    
    (2) A join point's demand-signature arity may exceed the Id's worker/wrapper
        arity.  See the `arity_ok` assertion in `mkWwBodies`.
    
    (3) In `finaliseArgBoxities`, do trimBoxity on any argument demands beyond
        the worker/wrapper arity.
    
    (4) In WorkWrap.splitFun, make sure we split based on the worker/wrapper
        arity (re)-computed by workWrapArity.
    a96cc423
Showing
with 456 additions and 206 deletions
......@@ -98,7 +98,35 @@ module GHC (
lookupGlobalName,
findGlobalAnns,
mkNamePprCtxForModule,
ModIface, ModIface_(..),
ModIface,
ModIface_(
mi_module,
mi_sig_of,
mi_hsc_src,
mi_src_hash,
mi_hi_bytes,
mi_deps,
mi_usages,
mi_exports,
mi_used_th,
mi_fixities,
mi_warns,
mi_anns,
mi_insts,
mi_fam_insts,
mi_rules,
mi_decls,
mi_extra_decls,
mi_top_env,
mi_hpc,
mi_trust,
mi_trust_pkg,
mi_complete_matches,
mi_docs,
mi_final_exts,
mi_ext_fields
),
pattern ModIface,
SafeHaskellMode(..),
-- * Printing
......
......@@ -445,7 +445,15 @@ It has these properties:
* When instantiated at a lifted type it is inhabited by at least one value,
namely bottom
* You can safely coerce any /lifted/ type to Any, and back with unsafeCoerce.
* You can safely coerce any /lifted/ type to Any and back with unsafeCoerce.
You can safely coerce any /unlifted/ type to Any and back with unsafeCoerceUnlifted.
You can coerce /any/ type to Any and back with unsafeCoerce#, but it's only safe when
the kinds of both the type and Any match.
For lifted/unlifted types unsafeCoerce[Unlifted] should be preferred over unsafeCoerce#
as they prevent accidentally coercing between types with kinds that don't match.
See examples in ghc-prim:GHC.Types
* It does not claim to be a *data* type, and that's important for
the code generator, because the code gen may *enter* a data value
......
......@@ -1151,6 +1151,7 @@ callishMachOps platform = listToUFM $
[ allWidths "popcnt" MO_PopCnt
, allWidths "pdep" MO_Pdep
, allWidths "pext" MO_Pext
, allWidths "bswap" MO_BSwap
, allWidths "cmpxchg" MO_Cmpxchg
, allWidths "xchg" MO_Xchg
, allWidths "load_relaxed" (\w -> MO_AtomicRead w MemOrderAcquire)
......
......@@ -171,7 +171,6 @@ regUsageOfInstr platform instr = case instr of
-- Is this register interesting for the register allocator?
interesting :: Platform -> Reg -> Bool
interesting _ (RegVirtual _) = True
interesting _ (RegReal (RealRegSingle (-1))) = False
interesting platform (RegReal (RealRegSingle i)) = freeReg platform i
-- Save caller save registers
......@@ -758,15 +757,10 @@ data Operand
opReg :: Width -> Reg -> Operand
opReg = OpReg
xzr, wzr, sp, ip0 :: Operand
xzr = OpReg W64 (RegReal (RealRegSingle (-1)))
wzr = OpReg W32 (RegReal (RealRegSingle (-1)))
sp, ip0 :: Operand
sp = OpReg W64 (RegReal (RealRegSingle 31))
ip0 = OpReg W64 (RegReal (RealRegSingle 16))
reg_zero :: Reg
reg_zero = RegReal (RealRegSingle (-1))
_x :: Int -> Operand
_x i = OpReg W64 (RegReal (RealRegSingle i))
x0, x1, x2, x3, x4, x5, x6, x7 :: Operand
......
......@@ -587,7 +587,7 @@ pprInstr platform instr = case instr of
JMP lbl _
-- We never jump to ForeignLabels; if we ever do, c.f. handling for "BL"
| isForeignLabel lbl -> panic "PPC.Ppr.pprInstr: JMP to ForeignLabel"
| isForeignLabel lbl -> pprPanic "PPC.Ppr.pprInstr: JMP to ForeignLabel" (pprDebugCLabel platform lbl)
| otherwise ->
line $ hcat [ -- an alias for b that takes a CLabel
text "\tb\t",
......
......@@ -1045,22 +1045,16 @@ lower_CmmExpr_Typed lbl ty expr = do
lower_CmmExpr_Ptr :: CLabel -> CmmExpr -> WasmCodeGenM w (WasmExpr w w, Int)
lower_CmmExpr_Ptr lbl ptr = do
ty_word <- wasmWordTypeM
case ptr of
CmmLit (CmmLabelOff lbl o)
| o >= 0 -> do
instrs <-
lower_CmmExpr_Typed
lbl
ty_word
(CmmLit $ CmmLabel lbl)
pure (instrs, o)
CmmMachOp (MO_Add _) [base, CmmLit (CmmInt o _)]
| o >= 0 -> do
instrs <- lower_CmmExpr_Typed lbl ty_word base
pure (instrs, fromInteger o)
_ -> do
instrs <- lower_CmmExpr_Typed lbl ty_word ptr
pure (instrs, 0)
let (ptr', o) = case ptr of
CmmLit (CmmLabelOff lbl o)
| o >= 0 -> (CmmLit $ CmmLabel lbl, o)
CmmRegOff reg o
| o >= 0 -> (CmmReg reg, o)
CmmMachOp (MO_Add _) [base, CmmLit (CmmInt o _)]
| o >= 0 -> (base, fromInteger o)
_ -> (ptr, 0)
instrs <- lower_CmmExpr_Typed lbl ty_word ptr'
pure (instrs, o)
-- | Push a series of values onto the wasm value stack, returning the
-- result stack type.
......
......@@ -635,11 +635,16 @@ lintLetBind top_lvl rec_flag binder rhs rhs_ty
-- in GHC.Core.Opt.DmdAnal
; case splitDmdSig (idDmdSig binder) of
(demands, result_info) | isDeadEndDiv result_info ->
checkL (demands `lengthAtLeast` idArity binder)
(text "idArity" <+> ppr (idArity binder) <+>
text "exceeds arity imposed by the strictness signature" <+>
ppr (idDmdSig binder) <> colon <+>
ppr binder)
if (demands `lengthAtLeast` idArity binder)
then return ()
else pprTrace "Hack alert: lintLetBind #24623"
(ppr (idArity binder) $$ ppr (idDmdSig binder)) $
return ()
-- checkL (demands `lengthAtLeast` idArity binder)
-- (text "idArity" <+> ppr (idArity binder) <+>
-- text "exceeds arity imposed by the strictness signature" <+>
-- ppr (idDmdSig binder) <> colon <+>
-- ppr binder)
_ -> return ()
......
......@@ -1008,7 +1008,7 @@ dmdTransform :: AnalEnv -- ^ The analysis environment
-> DmdType -- ^ The demand type unleashed by the variable in this
-- context. The returned DmdEnv includes the demand on
-- this function plus demand on its free variables
-- See Note [What are demand signatures?] in "GHC.Types.Demand"
-- See Note [DmdSig: demand signatures, and demand-sig arity] in "GHC.Types.Demand"
dmdTransform env var sd
-- Data constructors
| Just con <- isDataConWorkId_maybe var
......@@ -1081,31 +1081,33 @@ dmdAnalRhsSig
-- Process the RHS of the binding, add the strictness signature
-- to the Id, and augment the environment with the signature as well.
-- See Note [NOINLINE and strictness]
dmdAnalRhsSig top_lvl rec_flag env let_dmd id rhs
dmdAnalRhsSig top_lvl rec_flag env let_sd id rhs
= -- pprTrace "dmdAnalRhsSig" (ppr id $$ ppr let_dmd $$ ppr rhs_dmds $$ ppr sig $$ ppr weak_fvs) $
(final_env, weak_fvs, final_id, final_rhs)
where
threshold_arity = thresholdArity id rhs
ww_arity = workWrapArity id rhs
-- See Note [Worker/wrapper arity and join points] point (1)
rhs_dmd = mkCalledOnceDmds threshold_arity body_dmd
body_dmd
| isJoinId id
body_sd | isJoinId id = let_sd
| otherwise = topSubDmd
-- See Note [Demand analysis for join points]
-- See Note [Invariants on join points] invariant 2b, in GHC.Core
-- threshold_arity matches the join arity of the join point
-- See Note [Unboxed demand on function bodies returning small products]
= unboxedWhenSmall env rec_flag (resultType_maybe id) let_dmd
| otherwise
-- ww_arity matches the join arity of the join point
adjusted_body_sd = unboxedWhenSmall env rec_flag (resultType_maybe id) body_sd
-- See Note [Unboxed demand on function bodies returning small products]
= unboxedWhenSmall env rec_flag (resultType_maybe id) topSubDmd
WithDmdType rhs_dmd_ty rhs' = dmdAnal env rhs_dmd rhs
rhs_sd = mkCalledOnceDmds ww_arity adjusted_body_sd
WithDmdType rhs_dmd_ty rhs' = dmdAnal env rhs_sd rhs
DmdType rhs_env rhs_dmds = rhs_dmd_ty
(final_rhs_dmds, final_rhs) = finaliseArgBoxities env id threshold_arity
(final_rhs_dmds, final_rhs) = finaliseArgBoxities env id ww_arity
rhs_dmds (de_div rhs_env) rhs'
sig = mkDmdSigForArity threshold_arity (DmdType sig_env final_rhs_dmds)
dmd_sig_arity = ww_arity + strictCallArity body_sd
sig = mkDmdSigForArity dmd_sig_arity (DmdType sig_env final_rhs_dmds)
-- strictCallArity is > 0 only for join points
-- See Note [mkDmdSigForArity]
opts = ae_opts env
final_id = setIdDmdAndBoxSig opts id sig
......@@ -1137,13 +1139,6 @@ splitWeakDmds :: DmdEnv -> (DmdEnv, WeakDmds)
splitWeakDmds (DE fvs div) = (DE sig_fvs div, weak_fvs)
where (!weak_fvs, !sig_fvs) = partitionVarEnv isWeakDmd fvs
thresholdArity :: Id -> CoreExpr -> Arity
-- See Note [Demand signatures are computed for a threshold arity based on idArity]
thresholdArity fn rhs
= case idJoinPointHood fn of
JoinPoint join_arity -> count isId $ fst $ collectNBinders join_arity rhs
NotJoinPoint -> idArity fn
-- | The result type after applying 'idArity' many arguments. Returns 'Nothing'
-- when the type doesn't have exactly 'idArity' many arrows.
resultType_maybe :: Id -> Maybe Type
......@@ -1243,47 +1238,97 @@ Consider
B -> j 4
C -> (p,7))
If j was a vanilla function definition, we'd analyse its body with
evalDmd, and think that it was lazy in p. But for join points we can
do better! We know that j's body will (if called at all) be evaluated
with the demand that consumes the entire join-binding, in this case
the argument demand from g. Whizzo! g evaluates both components of
its argument pair, so p will certainly be evaluated if j is called.
If j was a vanilla function definition, we'd analyse its body with evalDmd, and
think that it was lazy in p. But for join points we can do better! We know
that j's body will (if called at all) be evaluated with the demand that consumes
the entire join-binding, in this case the argument demand from g. Whizzo! g
evaluates both components of its argument pair, so p will certainly be evaluated
if j is called.
For f to be strict in p, we need /all/ paths to evaluate p; in this
case the C branch does so too, so we are fine. So, as usual, we need
to transport demands on free variables to the call site(s). Compare
Note [Lazy and unleashable free variables].
For f to be strict in p, we need /all/ paths to evaluate p; in this case the C
branch does so too, so we are fine. So, as usual, we need to transport demands
on free variables to the call site(s). Compare Note [Lazy and unleashable free
variables].
The implementation is easy. When analysing a join point, we can
analyse its body with the demand from the entire join-binding (written
let_dmd here).
The implementation is easy: see `body_sd` in`dmdAnalRhsSig`. When analysing
a join point, we can analyse its body (after stripping off the join binders,
here just 'y') with the demand from the entire join-binding (written `let_sd`
here).
Another win for join points! #13543.
However, note that the strictness signature for a join point can
look a little puzzling. E.g.
BUT see Note [Worker/wrapper arity and join points].
Note we may analyse the rhs of a join point with a demand that is either
bigger than, or smaller than, the number of lambdas syntactically visible.
* More lambdas than call demands:
join j x = \p q r -> blah in ...
in a context with demand Top.
* More call demands than lambdas:
(join j x = h in ..(j 2)..(j 3)) a b c
Note [Worker/wrapper arity and join points]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider
(join j x = \y. error "urk")
(in case v of )
( A -> j 3 ) x
( B -> j 4 )
( C -> \y. blah )
The entire thing is in a C(1,L) context, so j's strictness signature
will be [A]b
meaning one absent argument, returns bottom. That seems odd because
there's a \y inside. But it's right because when consumed in a C(1,L)
context the RHS of the join point is indeed bottom.
The entire thing is in a C(1,L) context, so we will analyse j's body, namely
\y. error "urk"
with demand C(C(1,L)). See `rhs_sd` in `dmdAnalRhsSig`. That will produce
a demand signature of <A><A>b: and indeed `j` diverges when given two arguments.
BUT we do /not/ want to worker/wrapper `j` with two arguments. Suppose we have
join j2 :: Int -> Int -> blah
j2 x = rhs
in ...(j2 3)...(j2 4)...
where j2's join-arity is 1, so calls to `j` will all have /one/ argument.
Suppose the entire expression is in a called context (like `j` above) and `j2`
gets the demand signature <1!P(L)><1!P(L)>, that is, strict in both arguments.
we worker/wrapper'd `j2` with two args we'd get
join $wj2 x# y# = let x = I# x#; y = I# y# in rhs
j2 x = \y. case x of I# x# -> case y of I# y# -> $wj2 x# y#
in ...(j2 3)...(j2 4)...
But now `$wj2`is no longer a join point. Boo.
Instead if we w/w at all, we want to do so only with /one/ argument:
join $wj2 x# = let x = I# x# in rhs
j2 x = case x of I# x# -> $wj2 x#
in ...(j2 3)...(j2 4)...
Now all is fine. BUT in `finaliseArgBoxities` we should trim y's boxity,
to reflect the fact tta we aren't going to unbox `y` at all.
Conclusion:
(1) The "worker/wrapper arity" of an Id is
* For non-join-points: idArity
* The join points: the join arity (Id part only of course)
This is the number of args we will use in worker/wrapper.
See `ww_arity` in `dmdAnalRhsSig`, and the function `workWrapArity`.
Note [Demand signatures are computed for a threshold arity based on idArity]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Given a binding { f = rhs }, we compute a "theshold arity", and do demand
analysis based on a call with that many value arguments.
(2) A join point's demand-signature arity may exceed the Id's worker/wrapper
arity. See the `arity_ok` assertion in `mkWwBodies`.
The threshold we use is
(3) In `finaliseArgBoxities`, do trimBoxity on any argument demands beyond
the worker/wrapper arity.
* Ordinary bindings: idArity f.
(4) In WorkWrap.splitFun, make sure we split based on the worker/wrapper
arity (re)-computed by workWrapArity.
Note [The demand for the RHS of a binding]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Given a binding { f = rhs }, in `dmdAnalRhsSig` we compute a `rhs_sd` in
which to analyse `rhs`.
The demand we use is:
* Ordinary bindings: a call-demand of depth (idArity f).
Why idArity arguments? Because that's a conservative estimate of how many
arguments we must feed a function before it does anything interesting with
them. Also it elegantly subsumes the trivial RHS and PAP case. E.g. for
......@@ -1293,22 +1338,17 @@ The threshold we use is
idArity is /at least/ the number of manifest lambdas, but might be higher for
PAPs and trivial RHS (see Note [Demand analysis for trivial right-hand sides]).
* Join points: the value-binder subset of the JoinArity. This can
be less than the number of visible lambdas; e.g.
join j x = \y. blah
in ...(jump j 2)....(jump j 3)....
We know that j will never be applied to more than 1 arg (its join
arity, and we don't eta-expand join points, so here a threshold
of 1 is the best we can do.
* Join points: a call-demand of depth (value-binder subset of JoinArity),
wrapped around the incoming demand for the entire expression; see
Note [Demand analysis for join points]
Note that the idArity of a function varies independently of its cardinality
properties (cf. Note [idArity varies independently of dmdTypeDepth]), so we
implicitly encode the arity for when a demand signature is sound to unleash
in its 'dmdTypeDepth', not in its idArity (cf. Note [Understanding DmdType
and DmdSig] in GHC.Types.Demand). It is unsound to unleash a demand
signature when the incoming number of arguments is less than that. See
GHC.Types.Demand Note [What are demand signatures?] for more details on
soundness.
implicitly encode the arity for when a demand signature is sound to unleash in
its 'dmdTypeDepth', not in its idArity (cf. Note [Understanding DmdType and
DmdSig] in GHC.Types.Demand). It is unsound to unleash a demand signature when
the incoming number of arguments is less than that. See GHC.Types.Demand
Note [DmdSig: demand signatures, and demand-sig arity].
Note that there might, in principle, be functions for which we might want to
analyse for more incoming arguments than idArity. Example:
......@@ -1339,6 +1379,30 @@ signatures for different arities (i.e., polyvariance) would be entirely
possible, if it weren't for the additional runtime and implementation
complexity.
Note [mkDmdSigForArity]
~~~~~~~~~~~~~~~~~~~~~~~
Consider
f x = if expensive x
then \y. blah1
else \y. blah2
We will analyse the body with demand C(1L), reflecting the single visible
argument x. But dmdAnal will return a DmdType looking like
DmdType fvs [x-dmd, y-dmd]
because it has seen two lambdas, \x and \y. Since the length of the argument
demands in a DmdSig gives the "threshold" for applying the signature
(see Note [DmdSig: demand signatures, and demand-sig arity] in GHC.Types.Demand)
we must trim that DmdType to just
DmdSig (DmdTypte fvs [x-dmd])
when making that DmdType into the DmdSig for f. This trimming is the job of
`mkDmdSigForArity`.
Alternative. An alternative would be be to ensure that if
(dmd_ty, e') = dmdAnal env subdmd e
then the length dmds in dmd_ty is always less than (or maybe equal to?) the
call-depth of subdmd. To do that we'd need to adjust the Lam case of dmdAnal.
Probably not hard, but a job for another day; see discussion on !12873, #23113,
and #21392.
Note [idArity varies independently of dmdTypeDepth]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In general, an Id `f` has two independently varying attributes:
......@@ -1932,30 +1996,35 @@ positiveTopBudget (MkB n _) = n >= 0
finaliseArgBoxities :: AnalEnv -> Id -> Arity
-> [Demand] -> Divergence
-> CoreExpr -> ([Demand], CoreExpr)
finaliseArgBoxities env fn threshold_arity rhs_dmds div rhs
-- POSTCONDITION:
-- If: (dmds', rhs') = finaliseArgBoxitities ... dmds .. rhs
-- Then:
-- dmds' is the same as dmds (including length), except for boxity info
-- rhs' is the same as rhs, except for dmd info on lambda binders
-- NB: For join points, length dmds might be greater than ww_arity
finaliseArgBoxities env fn ww_arity arg_dmds div rhs
-- Check for an OPAQUE function: see Note [OPAQUE pragma]
-- In that case, trim off all boxity info from argument demands
-- and demand info on lambda binders
-- See Note [The OPAQUE pragma and avoiding the reboxing of arguments]
| isOpaquePragma (idInlinePragma fn)
, let trimmed_rhs_dmds = map trimBoxity rhs_dmds
= (trimmed_rhs_dmds, set_lam_dmds trimmed_rhs_dmds rhs)
, let trimmed_arg_dmds = map trimBoxity arg_dmds
= (trimmed_arg_dmds, set_lam_dmds trimmed_arg_dmds rhs)
-- Check that we have enough visible binders to match the
-- threshold arity; if not, we won't do worker/wrapper
-- ww arity; if not, we won't do worker/wrapper
-- This happens if we have simply {f = g} or a PAP {f = h 13}
-- we simply want to give f the same demand signature as g
-- How can such bindings arise? Perhaps from {-# NOLINE[2] f #-},
-- or if the call to `f` is currently not-applied (map f xs).
-- It's a bit of a corner case. Anyway for now we pass on the
-- unadulterated demands from the RHS, without any boxity trimming.
| threshold_arity > count isId bndrs
= (rhs_dmds, rhs)
| ww_arity > count isId bndrs
= (arg_dmds, rhs)
-- The normal case
| otherwise -- NB: threshold_arity might be less than
-- manifest arity for join points
| otherwise
= -- pprTrace "finaliseArgBoxities" (
-- vcat [text "function:" <+> ppr fn
-- , text "max" <+> ppr max_wkr_args
......@@ -1966,23 +2035,29 @@ finaliseArgBoxities env fn threshold_arity rhs_dmds div rhs
-- of the function, both because that's kosher, and because CPR analysis
-- uses the info on the binders directly.
where
opts = ae_opts env
(bndrs, _body) = collectBinders rhs
unarise_arity = sum [ unariseArity (idType b) | b <- bndrs, isId b ]
max_wkr_args = dmd_max_worker_args opts `max` unarise_arity
-- This is the budget initialisation step of
-- Note [Worker argument budget]
-- This is the key line, which uses almost-circular programming
-- The remaining budget from one layer becomes the initial
-- budget for the next layer down. See Note [Worker argument budget]
(remaining_budget, arg_dmds') = go_args (MkB max_wkr_args remaining_budget) arg_triples
opts = ae_opts env
(bndrs, _body) = collectBinders rhs
-- NB: in the interesting code path, count isId bndrs >= ww_arity
arg_triples :: [(Type, StrictnessMark, Demand)]
arg_triples = take threshold_arity $
arg_triples = take ww_arity $
[ (idType bndr, NotMarkedStrict, get_dmd bndr)
| bndr <- bndrs, isRuntimeVar bndr ]
arg_dmds' = ww_arg_dmds ++ map trimBoxity (drop ww_arity arg_dmds)
-- If ww_arity < length arg_dmds, the leftover ones
-- will not be w/w'd, so trimBoxity them
-- See Note [Worker/wrapper arity and join points] point (3)
-- This is the key line, which uses almost-circular programming
-- The remaining budget from one layer becomes the initial
-- budget for the next layer down. See Note [Worker argument budget]
(remaining_budget, ww_arg_dmds) = go_args (MkB max_wkr_args remaining_budget) arg_triples
unarise_arity = sum [ unariseArity (idType b) | b <- bndrs, isId b ]
max_wkr_args = dmd_max_worker_args opts `max` unarise_arity
-- This is the budget initialisation step of
-- Note [Worker argument budget]
get_dmd :: Id -> Demand
get_dmd bndr
| is_bot_fn = unboxDeeplyDmd dmd -- See Note [Boxity for bottoming functions],
......
......@@ -639,6 +639,17 @@ That is we make the specialized function strict in arguments
representing strict fields. See Note [Call-by-value for worker args]
for why we do this.
(SCF1) The arg_id might be an /imported/ Id like M.foo_acf (see #24944).
We don't want to make
case M.foo_acf of M.foo_acf { DEFAULT -> blah }
because the binder of a case-expression should never be imported. Rather,
we must localise it thus:
case M.foo_acf of foo_acf { DEFAULT -> blah }
We keep the same unique, so in the next round of simplification we'll replace
any M.foo_acf's in `blah` by `foo_acf`.
c.f. Note [Localise pattern binders] in GHC.HsToCore.Utils.
Note [Specialising on dictionaries]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In #21386, SpecConstr saw this call:
......@@ -2030,8 +2041,8 @@ generaliseDictPats qvars pats
| otherwise
= return (extra_qvs, pat)
-- See Note [SpecConstr and strict fields]
mkSeqs :: [Var] -> Type -> CoreExpr -> CoreExpr
-- See Note [SpecConstr and strict fields]
mkSeqs seqees res_ty rhs =
foldr addEval rhs seqees
where
......@@ -2039,7 +2050,11 @@ mkSeqs seqees res_ty rhs =
addEval arg_id rhs
-- Argument representing strict field and it's worth passing via cbv
| shouldStrictifyIdForCbv arg_id
= Case (Var arg_id) arg_id res_ty ([Alt DEFAULT [] rhs])
= Case (Var arg_id)
(localiseId arg_id) -- See (SCF1) in Note [SpecConstr and strict fields]
res_ty
([Alt DEFAULT [] rhs])
| otherwise
= rhs
......
......@@ -758,11 +758,11 @@ by LitRubbish (see Note [Drop absent bindings]) so there is no great harm.
---------------------
splitFun :: WwOpts -> Id -> CoreExpr -> UniqSM [(Id, CoreExpr)]
splitFun ww_opts fn_id rhs
| Just (arg_vars, body) <- collectNValBinders_maybe (length wrap_dmds) rhs
| Just (arg_vars, body) <- collectNValBinders_maybe ww_arity rhs
= warnPprTrace (not (wrap_dmds `lengthIs` (arityInfo fn_info)))
"splitFun"
(ppr fn_id <+> (ppr wrap_dmds $$ ppr cpr)) $
do { mb_stuff <- mkWwBodies ww_opts fn_id arg_vars (exprType body) wrap_dmds cpr
do { mb_stuff <- mkWwBodies ww_opts fn_id ww_arity arg_vars (exprType body) wrap_dmds cpr
; case mb_stuff of
Nothing -> -- No useful wrapper; leave the binding alone
return [(fn_id, rhs)]
......@@ -794,8 +794,10 @@ splitFun ww_opts fn_id rhs
= return [(fn_id, rhs)]
where
uf_opts = so_uf_opts (wo_simple_opts ww_opts)
fn_info = idInfo fn_id
uf_opts = so_uf_opts (wo_simple_opts ww_opts)
fn_info = idInfo fn_id
ww_arity = workWrapArity fn_id rhs
-- workWrapArity: see (4) in Note [Worker/wrapper arity and join points] in DmdAnal
(wrap_dmds, div) = splitDmdSig (dmdSigInfo fn_info)
......
......@@ -15,7 +15,7 @@ module GHC.Core.Opt.WorkWrap.Utils
, findTypeShape, IsRecDataConResult(..), isRecDataCon
, mkAbsentFiller
, isWorkerSmallEnough, dubiousDataConInstArgTys
, boringSplit , usefulSplit
, boringSplit, usefulSplit, workWrapArity
)
where
......@@ -159,6 +159,7 @@ nop_fn body = body
mkWwBodies :: WwOpts
-> Id -- ^ The original function
-> Arity -- ^ Worker/wrapper arity
-> [Var] -- ^ Manifest args of original function
-> Type -- ^ Result type of the original function,
-- after being stripped of args
......@@ -205,8 +206,8 @@ mkWwBodies :: WwOpts
-- and beta-redexes]), which allows us to apply the same split to function body
-- and its unfolding(s) alike.
--
mkWwBodies opts fun_id arg_vars res_ty demands res_cpr
= do { massertPpr (filter isId arg_vars `equalLength` demands)
mkWwBodies opts fun_id ww_arity arg_vars res_ty demands res_cpr
= do { massertPpr arity_ok
(text "wrong wrapper arity" $$ ppr fun_id $$ ppr arg_vars $$ ppr res_ty $$ ppr demands)
-- Clone and prepare arg_vars of the original fun RHS
......@@ -271,6 +272,10 @@ mkWwBodies opts fun_id arg_vars res_ty demands res_cpr
| otherwise
= False
n_dmds = length demands
arity_ok | isJoinId fun_id = ww_arity <= n_dmds
| otherwise = ww_arity == n_dmds
-- | Version of 'GHC.Core.mkApps' that does beta reduction on-the-fly.
-- PRECONDITION: The arg expressions are not free in any of the lambdas binders.
mkAppsBeta :: CoreExpr -> [CoreArg] -> CoreExpr
......@@ -288,6 +293,13 @@ isWorkerSmallEnough max_worker_args old_n_args vars
-- Also if the function took 82 arguments before (old_n_args), it's fine if
-- it takes <= 82 arguments afterwards.
workWrapArity :: Id -> CoreExpr -> Arity
-- See Note [Worker/wrapper arity and join points] in DmdAnal
workWrapArity fn rhs
= case idJoinPointHood fn of
JoinPoint join_arity -> count isId $ fst $ collectNBinders join_arity rhs
NotJoinPoint -> idArity fn
{-
Note [Always do CPR w/w]
~~~~~~~~~~~~~~~~~~~~~~~~
......
......@@ -303,16 +303,19 @@ runTyCoVars f = appEndo f emptyVarSet
********************************************************************* -}
tyCoVarsOfType :: Type -> TyCoVarSet
-- The "deep" TyCoVars of the the type
tyCoVarsOfType ty = runTyCoVars (deep_ty ty)
-- Alternative:
-- tyCoVarsOfType ty = closeOverKinds (shallowTyCoVarsOfType ty)
tyCoVarsOfTypes :: [Type] -> TyCoVarSet
-- The "deep" TyCoVars of the the type
tyCoVarsOfTypes tys = runTyCoVars (deep_tys tys)
-- Alternative:
-- tyCoVarsOfTypes tys = closeOverKinds (shallowTyCoVarsOfTypes tys)
tyCoVarsOfCo :: Coercion -> TyCoVarSet
-- The "deep" TyCoVars of the the coercion
-- See Note [Free variables of types]
tyCoVarsOfCo co = runTyCoVars (deep_co co)
......
......@@ -93,6 +93,13 @@ pprPrecTypeX env prec ty
-- NB: debug-style is used for -dppr-debug
-- dump-style is used for -ddump-tc-trace etc
tidyToIfaceTypeStyX :: TidyEnv -> Type -> PprStyle -> IfaceType
tidyToIfaceTypeStyX env ty sty
| userStyle sty = tidyToIfaceTypeX env ty
| otherwise = toIfaceTypeX (tyCoVarsOfType ty) ty
-- in latter case, don't tidy, as we'll be printing uniques.
pprTyLit :: TyLit -> SDoc
pprTyLit = pprIfaceTyLit . toIfaceTyLit
......@@ -100,12 +107,6 @@ pprKind, pprParendKind :: Kind -> SDoc
pprKind = pprType
pprParendKind = pprParendType
tidyToIfaceTypeStyX :: TidyEnv -> Type -> PprStyle -> IfaceType
tidyToIfaceTypeStyX env ty sty
| userStyle sty = tidyToIfaceTypeX env ty
| otherwise = toIfaceTypeX (tyCoVarsOfType ty) ty
-- in latter case, don't tidy, as we'll be printing uniques.
tidyToIfaceType :: Type -> IfaceType
tidyToIfaceType = tidyToIfaceTypeX emptyTidyEnv
......@@ -117,9 +118,12 @@ tidyToIfaceTypeX :: TidyEnv -> Type -> IfaceType
-- leave them as IfaceFreeTyVar. This is super-important
-- for debug printing.
tidyToIfaceTypeX env ty = toIfaceTypeX (mkVarSet free_tcvs) (tidyType env' ty)
-- NB: if the type has /already/ been tidied (for example by the typechecker)
-- the tidy step here is a no-op. See Note [Tidying is idempotent]
-- in GHC.Core.TyCo.Tidy
where
env' = tidyFreeTyCoVars env free_tcvs
free_tcvs = tyCoVarsOfTypeWellScoped ty
free_tcvs = tyCoVarsOfTypeList ty
------------
pprCo, pprParendCo :: Coercion -> SDoc
......
......@@ -4,23 +4,25 @@
module GHC.Core.TyCo.Tidy
(
-- * Tidying type related things up for printing
tidyType, tidyTypes,
tidyOpenType, tidyOpenTypes,
tidyVarBndr, tidyVarBndrs, tidyFreeTyCoVars, avoidNameClashes,
tidyOpenTyCoVar, tidyOpenTyCoVars,
tidyTyCoVarOcc,
tidyType, tidyTypes,
tidyCo, tidyCos,
tidyTopType,
tidyCo, tidyCos,
tidyForAllTyBinder, tidyForAllTyBinders
tidyOpenType, tidyOpenTypes,
tidyOpenTypeX, tidyOpenTypesX,
tidyFreeTyCoVars, tidyFreeTyCoVarX, tidyFreeTyCoVarsX,
tidyAvoiding,
tidyVarBndr, tidyVarBndrs, avoidNameClashes,
tidyForAllTyBinder, tidyForAllTyBinders,
tidyTyCoVarOcc
) where
import GHC.Prelude
import GHC.Data.FastString
import GHC.Core.TyCo.Rep
import GHC.Core.TyCo.FVs (tyCoVarsOfTypesWellScoped, tyCoVarsOfTypeList)
import GHC.Data.Maybe (orElse)
import GHC.Core.TyCo.FVs
import GHC.Types.Name hiding (varName)
import GHC.Types.Var
import GHC.Types.Var.Env
......@@ -29,12 +31,76 @@ import GHC.Utils.Misc (strictMap)
import Data.List (mapAccumL)
{-
%************************************************************************
%* *
\subsection{TidyType}
%* *
%************************************************************************
{- **********************************************************************
TidyType
********************************************************************** -}
{- Note [Tidying open types]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When tidying some open types [t1,..,tn], we find their free vars, and tidy them first.
But (tricky point) we restrict the occ_env part of inner_env to just the /free/
vars of [t1..tn], so that we don't gratuitously rename the /bound/ variables.
Example: assume the TidyEnv
({"a1","b"} , [a_4 :-> a1, b_7 :-> b])
and call tidyOpenTypes on
[a_1, forall a_2. Maybe (a_2,a_4), forall b. (b,a_1)]
All the a's have the same OccName, but different uniques.
The TidyOccEnv binding for "b" relates b_7, which doesn't appear free in the
these types at all, so we don't want that to mess up the tidying for the
(forall b...).
So we proceed as follows:
1. Find the free vars.
In our example:the free vars are a_1 and a_4:
2. Use tidyFreeTyCoVars to tidy them (workhorse: `tidyFreeCoVarX`)
In our example:
* a_4 already has a tidy form, a1, so don't change that
* a_1 gets tidied to a2
3. Trim the TidyOccEnv to OccNames of the tidied free vars (`trimTidyEnv`)
In our example "a1" and "a2"
4. Now tidy the types. In our example we get
[a2, forall a3. Maybe (a3,a1), forall b. (b, a2)]
Note [Tidying is idempotent]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Key invariant: tidyFreeTyCoVars is idempotent, at least if you start with
an empty TidyEnv. This is important because:
* The typechecker error message processing carefully tidies types, using
global knowledge; see for example calls to `tidyCt` in GHC.Tc.Errors.
* Then the type pretty-printer, GHC.Core.TyCo.Ppr.pprType tidies the type
again, because that's important for pretty-printing types in general.
But the second tidying is a no-op if the first step has happened, because
all the free vars will have distinct OccNames, so no renaming needs to happen.
Note [tidyAvoiding]
~~~~~~~~~~~~~~~~~~~
Consider tidying this unsolved constraint in GHC.Tc.Errors.report_unsolved.
C a_33, (forall a. Eq a => D a)
Here a_33 is a free unification variable. If we firs tidy [a_33 :-> "a"]
then we have no choice but to tidy the `forall a` to something else. But it
is confusing (sometimes very confusing) to gratuitously rename skolems in
this way -- see #24868. So it is better to :
* Find the /bound/ skolems (just `a` in this case)
* Initialise the TidyOccEnv to avoid using "a"
* Now tidy the free a_33 to, say, "a1"
* Delete "a" from the TidyOccEnv
This is done by `tidyAvoiding`.
The last step is very important; if we leave "a" in the TidyOccEnv, when
we get to the (forall a. blah) we'll rename `a` to "a2", avoiding "a".
-}
-- | This tidies up a type for printing in an error message, or in
......@@ -95,31 +161,38 @@ tidyForAllTyBinders tidy_env tvbs
tidyFreeTyCoVars :: TidyEnv -> [TyCoVar] -> TidyEnv
-- ^ Add the free 'TyVar's to the env in tidy form,
-- so that we can tidy the type they are free in
tidyFreeTyCoVars tidy_env tyvars
= fst (tidyOpenTyCoVars tidy_env tyvars)
-- Precondition: input free vars are closed over kinds and
-- This function does a scopedSort, so that tidied variables
-- have tidied kinds.
-- See Note [Tidying is idempotent]
tidyFreeTyCoVars tidy_env tyvars = fst (tidyFreeTyCoVarsX tidy_env tyvars)
---------------
tidyOpenTyCoVars :: TidyEnv -> [TyCoVar] -> (TidyEnv, [TyCoVar])
tidyOpenTyCoVars env tyvars = mapAccumL tidyOpenTyCoVar env tyvars
tidyFreeTyCoVarsX :: TidyEnv -> [TyCoVar] -> (TidyEnv, [TyCoVar])
-- Precondition: input free vars are closed over kinds and
-- This function does a scopedSort, so that tidied variables
-- have tidied kinds.
-- See Note [Tidying is idempotent]
tidyFreeTyCoVarsX env tyvars = mapAccumL tidyFreeTyCoVarX env $
scopedSort tyvars
---------------
tidyOpenTyCoVar :: TidyEnv -> TyCoVar -> (TidyEnv, TyCoVar)
tidyFreeTyCoVarX :: TidyEnv -> TyCoVar -> (TidyEnv, TyCoVar)
-- ^ Treat a new 'TyCoVar' as a binder, and give it a fresh tidy name
-- using the environment if one has not already been allocated. See
-- also 'tidyVarBndr'
tidyOpenTyCoVar env@(_, subst) tyvar
-- See Note [Tidying is idempotent]
tidyFreeTyCoVarX env@(_, subst) tyvar
= case lookupVarEnv subst tyvar of
Just tyvar' -> (env, tyvar') -- Already substituted
Nothing ->
let env' = tidyFreeTyCoVars env (tyCoVarsOfTypeList (tyVarKind tyvar))
in tidyVarBndr env' tyvar -- Treat it as a binder
Just tyvar' -> (env, tyvar') -- Already substituted
Nothing -> tidyVarBndr env tyvar -- Treat it as a binder
---------------
tidyTyCoVarOcc :: TidyEnv -> TyCoVar -> TyCoVar
tidyTyCoVarOcc env@(_, subst) tv
= case lookupVarEnv subst tv of
Nothing -> updateVarType (tidyType env) tv
Just tv' -> tv'
tidyTyCoVarOcc env@(_, subst) tcv
= case lookupVarEnv subst tcv of
Nothing -> updateVarType (tidyType env) tcv
Just tcv' -> tcv'
---------------
......@@ -157,22 +230,26 @@ tidyTypes env tys = strictMap (tidyType env) tys
--
-- See Note [Strictness in tidyType and friends]
tidyType :: TidyEnv -> Type -> Type
tidyType _ t@(LitTy {}) = t -- Preserve sharing
tidyType env (TyVarTy tv) = TyVarTy $! tidyTyCoVarOcc env tv
tidyType _ t@(TyConApp _ []) = t -- Preserve sharing if possible
tidyType env (TyConApp tycon tys) = TyConApp tycon $! tidyTypes env tys
tidyType env (AppTy fun arg) = (AppTy $! (tidyType env fun)) $! (tidyType env arg)
tidyType env ty@(FunTy _ w arg res) = let { !w' = tidyType env w
; !arg' = tidyType env arg
; !res' = tidyType env res }
in ty { ft_mult = w', ft_arg = arg', ft_res = res' }
tidyType env (ty@(ForAllTy{})) = (mkForAllTys' $! (zip tvs' vis)) $! tidyType env' body_ty
tidyType _ t@(LitTy {}) = t -- Preserve sharing
tidyType env (TyVarTy tv) = TyVarTy $! tidyTyCoVarOcc env tv
tidyType _ t@(TyConApp _ []) = t -- Preserve sharing if possible
tidyType env (TyConApp tycon tys) = TyConApp tycon $! tidyTypes env tys
tidyType env (AppTy fun arg) = (AppTy $! (tidyType env fun)) $! (tidyType env arg)
tidyType env (CastTy ty co) = (CastTy $! tidyType env ty) $! (tidyCo env co)
tidyType env (CoercionTy co) = CoercionTy $! (tidyCo env co)
tidyType env ty@(FunTy _ w arg res) = let { !w' = tidyType env w
; !arg' = tidyType env arg
; !res' = tidyType env res }
in ty { ft_mult = w', ft_arg = arg', ft_res = res' }
tidyType env (ty@(ForAllTy{})) = tidyForAllType env ty
tidyForAllType :: TidyEnv -> Type -> Type
tidyForAllType env ty
= (mkForAllTys' $! (zip tcvs' vis)) $! tidyType body_env body_ty
where
(tvs, vis, body_ty) = splitForAllTyCoVars' ty
(env', tvs') = tidyVarBndrs env tvs
tidyType env (CastTy ty co) = (CastTy $! tidyType env ty) $! (tidyCo env co)
tidyType env (CoercionTy co) = CoercionTy $! (tidyCo env co)
(tcvs, vis, body_ty) = splitForAllTyCoVars' ty
(body_env, tcvs') = tidyVarBndrs env tcvs
-- The following two functions differ from mkForAllTys and splitForAllTyCoVars in that
-- they expect/preserve the ForAllTyFlag argument. These belong to "GHC.Core.Type", but
......@@ -189,24 +266,53 @@ splitForAllTyCoVars' ty = go ty [] []
go ty tvs viss = (reverse tvs, reverse viss, ty)
---------------
tidyAvoiding :: [OccName]
-> (TidyEnv -> a -> TidyEnv)
-> a -> TidyEnv
-- Initialise an empty TidyEnv with some bound vars to avoid,
-- run the do_tidy function, and then remove the bound vars again.
-- See Note [tidyAvoiding]
tidyAvoiding bound_var_avoids do_tidy thing
= (occs' `delTidyOccEnvList` bound_var_avoids, vars')
where
(occs', vars') = do_tidy init_tidy_env thing
init_tidy_env = mkEmptyTidyEnv (initTidyOccEnv bound_var_avoids)
---------------
trimTidyEnv :: TidyEnv -> [TyCoVar] -> TidyEnv
trimTidyEnv (occ_env, var_env) tcvs
= (trimTidyOccEnv occ_env (map getOccName tcvs), var_env)
---------------
-- | Grabs the free type variables, tidies them
-- and then uses 'tidyType' to work over the type itself
tidyOpenTypes :: TidyEnv -> [Type] -> (TidyEnv, [Type])
tidyOpenTypes env tys
= (env', tidyTypes (trimmed_occ_env, var_env) tys)
tidyOpenTypesX :: TidyEnv -> [Type] -> (TidyEnv, [Type])
-- See Note [Tidying open types]
tidyOpenTypesX env tys
= (env1, tidyTypes inner_env tys)
where
free_tcvs :: [TyCoVar] -- Closed over kinds
free_tcvs = tyCoVarsOfTypesList tys
(env1, free_tcvs') = tidyFreeTyCoVarsX env free_tcvs
inner_env = trimTidyEnv env1 free_tcvs'
---------------
tidyOpenTypeX :: TidyEnv -> Type -> (TidyEnv, Type)
-- See Note [Tidying open types]
tidyOpenTypeX env ty
= (env1, tidyType inner_env ty)
where
(env'@(_, var_env), tvs') = tidyOpenTyCoVars env $
tyCoVarsOfTypesWellScoped tys
trimmed_occ_env = initTidyOccEnv (map getOccName tvs')
-- The idea here was that we restrict the new TidyEnv to the
-- _free_ vars of the types, so that we don't gratuitously rename
-- the _bound_ variables of the types.
free_tcvs = tyCoVarsOfTypeList ty
(env1, free_tcvs') = tidyFreeTyCoVarsX env free_tcvs
inner_env = trimTidyEnv env1 free_tcvs'
---------------
tidyOpenType :: TidyEnv -> Type -> (TidyEnv, Type)
tidyOpenType env ty = let (env', [ty']) = tidyOpenTypes env [ty] in
(env', ty')
tidyOpenTypes :: TidyEnv -> [Type] -> [Type]
tidyOpenTypes env ty = snd (tidyOpenTypesX env ty)
tidyOpenType :: TidyEnv -> Type -> Type
tidyOpenType env ty = snd (tidyOpenTypeX env ty)
---------------
-- | Calls 'tidyType' on a top-level type (i.e. with an empty tidying environment)
......@@ -219,7 +325,7 @@ tidyTopType ty = tidyType emptyTidyEnv ty
--
-- See Note [Strictness in tidyType and friends]
tidyCo :: TidyEnv -> Coercion -> Coercion
tidyCo env@(_, subst) co
tidyCo env co
= go co
where
go_mco MRefl = MRefl
......@@ -236,7 +342,7 @@ tidyCo env@(_, subst) co
-- of tv. But the alternative is to use coercionKind, which seems worse.
go (FunCo r afl afr w co1 co2) = ((FunCo r afl afr $! go w) $! go co1) $! go co2
go (CoVarCo cv) = CoVarCo $! go_cv cv
go (HoleCo h) = HoleCo h
go (HoleCo h) = HoleCo $! go_hole h
go (AxiomInstCo con ind cos) = AxiomInstCo con ind $! strictMap go cos
go (UnivCo p r t1 t2) = (((UnivCo $! (go_prov p)) $! r) $!
tidyType env t1) $! tidyType env t2
......@@ -249,7 +355,10 @@ tidyCo env@(_, subst) co
go (SubCo co) = SubCo $! go co
go (AxiomRuleCo ax cos) = AxiomRuleCo ax $ strictMap go cos
go_cv cv = lookupVarEnv subst cv `orElse` cv
go_cv cv = tidyTyCoVarOcc env cv
go_hole (CoercionHole cv r h) = (CoercionHole $! go_cv cv) r h
-- Tidy even the holes; tidied types should have tidied kinds
go_prov (PhantomProv co) = PhantomProv $! go co
go_prov (ProofIrrelProv co) = ProofIrrelProv $! go co
......
......@@ -226,8 +226,10 @@ module GHC.Core.Type (
-- * Tidying type related things up for printing
tidyType, tidyTypes,
tidyOpenType, tidyOpenTypes,
tidyVarBndr, tidyVarBndrs, tidyFreeTyCoVars,
tidyOpenTyCoVar, tidyOpenTyCoVars,
tidyOpenTypeX, tidyOpenTypesX,
tidyVarBndr, tidyVarBndrs,
tidyFreeTyCoVars,
tidyFreeTyCoVarX, tidyFreeTyCoVarsX,
tidyTyCoVarOcc,
tidyTopType,
tidyForAllTyBinder, tidyForAllTyBinders,
......
......@@ -86,8 +86,8 @@ import qualified Data.Set as Set
import GHC.Unit.Module.Graph
runHsc :: HscEnv -> Hsc a -> IO a
runHsc hsc_env (Hsc hsc) = do
(a, w) <- hsc hsc_env emptyMessages
runHsc hsc_env hsc = do
(a, w) <- runHsc' hsc_env hsc
let dflags = hsc_dflags hsc_env
let !diag_opts = initDiagOpts dflags
!print_config = initPrintConfig dflags
......
......@@ -64,6 +64,7 @@ module GHC.Driver.Main
, hscRecompStatus
, hscParse
, hscTypecheckRename
, hscTypecheckRenameWithDiagnostics
, hscTypecheckAndGetWarnings
, hscDesugar
, makeSimpleDetails
......@@ -642,7 +643,14 @@ extract_renamed_stuff mod_summary tc_result = do
-- | Rename and typecheck a module, additionally returning the renamed syntax
hscTypecheckRename :: HscEnv -> ModSummary -> HsParsedModule
-> IO (TcGblEnv, RenamedStuff)
hscTypecheckRename hsc_env mod_summary rdr_module = runHsc hsc_env $
hscTypecheckRename hsc_env mod_summary rdr_module =
fst <$> hscTypecheckRenameWithDiagnostics hsc_env mod_summary rdr_module
-- | Rename and typecheck a module, additionally returning the renamed syntax
-- and the diagnostics produced.
hscTypecheckRenameWithDiagnostics :: HscEnv -> ModSummary -> HsParsedModule
-> IO ((TcGblEnv, RenamedStuff), Messages GhcMessage)
hscTypecheckRenameWithDiagnostics hsc_env mod_summary rdr_module = runHsc' hsc_env $
hsc_typecheck True mod_summary (Just rdr_module)
-- | Do Typechecking without throwing SourceError exception with -Werror
......
......@@ -94,8 +94,6 @@ type instance XCModule GhcRn = DataConCantHappen
type instance XCModule GhcTc = DataConCantHappen
type instance XXModule p = DataConCantHappen
type instance Anno ModuleName = SrcSpanAnnA
deriving instance Data (HsModule GhcPs)
data AnnsModule
......
......@@ -810,8 +810,6 @@ ppr_con_names = pprWithCommas (pprPrefixOcc . unLoc)
type instance XCFamEqn (GhcPass _) r = [AddEpAnn]
type instance XXFamEqn (GhcPass _) r = DataConCantHappen
type instance Anno (FamEqn (GhcPass p) _) = SrcSpanAnnA
----------------- Class instances -------------
type instance XCClsInstDecl GhcPs = ( Maybe (LWarningTxt GhcPs)
......@@ -1025,8 +1023,6 @@ derivDeprecation = fmap unLoc . decl_deprecation (ghcPass @p)
= depr
decl_deprecation _ _ = Nothing
type instance Anno OverlapMode = SrcSpanAnnP
instance OutputableBndrId p
=> Outputable (DerivDecl (GhcPass p)) where
ppr (deriv@DerivDecl { deriv_type = ty
......@@ -1342,8 +1338,6 @@ type instance XCRoleAnnotDecl GhcTc = NoExtField
type instance XXRoleAnnotDecl (GhcPass _) = DataConCantHappen
type instance Anno (Maybe Role) = EpAnnCO
instance OutputableBndr (IdP (GhcPass p))
=> Outputable (RoleAnnotDecl (GhcPass p)) where
ppr (RoleAnnotDecl _ ltycon roles)
......
......@@ -1279,9 +1279,6 @@ type instance XXCmd GhcPs = DataConCantHappen
type instance XXCmd GhcRn = DataConCantHappen
type instance XXCmd GhcTc = HsWrap HsCmd
type instance Anno [LocatedA (StmtLR (GhcPass pl) (GhcPass pr) (LocatedA (HsCmd (GhcPass pr))))]
= SrcSpanAnnL
-- If cmd :: arg1 --> res
-- wrap :: arg1 "->" arg2
-- Then (XCmd (HsWrap wrap cmd)) :: arg2 --> res
......@@ -1491,7 +1488,7 @@ matchGroupArity (MG { mg_alts = alts })
hsLMatchPats :: LMatch (GhcPass id) body -> [LPat (GhcPass id)]
hsLMatchPats (L _ (Match { m_pats = pats })) = pats
hsLMatchPats (L _ (Match { m_pats = L _ pats })) = pats
-- We keep the type checker happy by providing EpAnnComments. They
-- can only be used if they follow a `where` keyword with no binds,
......@@ -1537,7 +1534,7 @@ pprPatBind pat grhss
pprMatch :: (OutputableBndrId idR, Outputable body)
=> Match (GhcPass idR) body -> SDoc
pprMatch (Match { m_pats = pats, m_ctxt = ctxt, m_grhss = grhss })
pprMatch (Match { m_pats = L _ pats, m_ctxt = ctxt, m_grhss = grhss })
= sep [ sep (herald : map (nest 2 . pprParendLPat appPrec) other_pats)
, nest 2 (pprGRHSs ctxt grhss) ]
where
......@@ -2391,6 +2388,7 @@ type instance Anno [LocatedA (Match (GhcPass p) (LocatedA (HsExpr (GhcPass p))))
type instance Anno [LocatedA (Match (GhcPass p) (LocatedA (HsCmd (GhcPass p))))] = SrcSpanAnnL
type instance Anno (Match (GhcPass p) (LocatedA (HsExpr (GhcPass p)))) = SrcSpanAnnA
type instance Anno (Match (GhcPass p) (LocatedA (HsCmd (GhcPass p)))) = SrcSpanAnnA
type instance Anno [LocatedA (Pat (GhcPass p))] = EpaLocation
type instance Anno (GRHS (GhcPass p) (LocatedA (HsExpr (GhcPass p)))) = EpAnnCO
type instance Anno (GRHS (GhcPass p) (LocatedA (HsCmd (GhcPass p)))) = EpAnnCO
type instance Anno (StmtLR (GhcPass pl) (GhcPass pr) (LocatedA (body (GhcPass pr)))) = SrcSpanAnnA
......