Hi Gergo,

Source Notes are what you are looking for. Currently the only way to
enable them is to either use `-g` or `-finfo-table-map`. The result
will be core which contains nodes which attempt to describe where the
core expression came from, it's not perfect though!

See Section 5.4 - https://etheses.whiterose.ac.uk/8321/1/thesis.pdf

Matt

On Tue, Dec 28, 2021 at 9:14 AM Erdi, Gergo via ghc-devs
<ghc-devs@haskell.org> wrote:
>
> PUBLIC
>
>
> Hi,
>
>
>
> I’m looking for ways to map Core fragments back to source locations.
>
>
>
> I see there is an annotated version of Core in `GHC/Core.hs` called 
> `AnnExpr`, which I could see being useful for this if I set the annotation 
> type to `SrcSpan`, but that’s not what I get out of GHC’s desugarer, 
> simplifier or tidier.
>
>
>
> If there’s no built-in mechanism for this, my only idea would be to create a 
> HsExpr-to-HsExpr transformation that wraps every node in a call that is 
> opaque enough to be persisted through Core-to-Core transformations but still 
> transparent enough that it doesn’t block optimization opportunities. Is that 
> even possible?
>
>
>
> Alternatively, would it make it easer if I was content with only getting 
> source locations for variable occurrences?
>
>
>
> Thanks,
>
>            Gergo
>
>
> This email and any attachments are confidential and may also be privileged. 
> If you are not the intended recipient, please delete all copies and notify 
> the sender immediately. You may wish to refer to the incorporation details of 
> Standard Chartered PLC, Standard Chartered Bank and their subsidiaries at 
> https: //www.sc.com/en/our-locations
>
> Where you have a Financial Markets relationship with Standard Chartered PLC, 
> Standard Chartered Bank and their subsidiaries (the "Group"), information on 
> the regulatory standards we adhere to and how it may affect you can be found 
> in our Regulatory Compliance Statement at https: //www.sc.com/rcs/ and 
> Regulatory Compliance Disclosures at http: //www.sc.com/rcs/fm
>
> Insofar as this communication is not sent by the Global Research team and 
> contains any market commentary, the market commentary has been prepared by 
> the sales and/or trading desk of Standard Chartered Bank or its affiliate. It 
> is not and does not constitute research material, independent research, 
> recommendation or financial advice. Any market commentary is for information 
> purpose only and shall not be relied on for any other purpose and is subject 
> to the relevant disclaimers available at https: 
> //www.sc.com/en/regulatory-disclosures/#market-disclaimer.
>
> Insofar as this communication is sent by the Global Research team and 
> contains any research materials prepared by members of the team, the research 
> material is for information purpose only and shall not be relied on for any 
> other purpose, and is subject to the relevant disclaimers available at https: 
> //research.sc.com/research/api/application/static/terms-and-conditions.
>
> Insofar as this e-mail contains the term sheet for a proposed transaction, by 
> responding affirmatively to this e-mail, you agree that you have understood 
> the terms and conditions in the attached term sheet and evaluated the merits 
> and risks of the transaction. We may at times also request you to sign the 
> term sheet to acknowledge the same.
>
> Please visit https: //www.sc.com/en/regulatory-disclosures/dodd-frank/ for 
> important information with respect to derivative products.
> _______________________________________________
> ghc-devs mailing list
> ghc-devs@haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
_______________________________________________
ghc-devs mailing list
ghc-devs@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

Reply via email to