Where else do I need to register fixity declarations?

PUBLIC Hi, In the attached program, I am typechecking two Haskell modules with GHC 9.0.1: `Imported.hs` defines some infix operators, and `Importer.hs` uses them. After typechecking the first one, I put it in the moduleNameProvidersMap and the HPT. However, when I am typechecking the second one, the fixity declarations of the infix operators aren't picked up correctly. I know they aren't because I have defined operators that only typecheck if they are parsed right-associatively. In contrast, if I put both the definitions and the usage into the same file (`Standalone.hs`), typechecking succeeds (as I would expect it to). What am I doing wrong? Is filling the `mi_fixities` field of the `ModIface` not enough to let importers see the correct fixities? 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.

I should add that I've also tried adding the just-loaded module to the EPS
but that also doesn't fix the issue.
On Tue, Jul 27, 2021, 15:14 Erdi, Gergo via ghc-devs
Hi,
In the attached program, I am typechecking two Haskell modules with GHC 9.0.1: `Imported.hs` defines some infix operators, and `Importer.hs` uses them. After typechecking the first one, I put it in the moduleNameProvidersMap and the HPT. However, when I am typechecking the second one, the fixity declarations of the infix operators aren’t picked up correctly. I know they aren’t because I have defined operators that only typecheck if they are parsed right-associatively. In contrast, if I put both the definitions and the usage into the same file (`Standalone.hs`), typechecking succeeds (as I would expect it to).
What am I doing wrong? Is filling the `mi_fixities` field of the `ModIface` not enough to let importers see the correct fixities?
Thanks,
Gergo

What am I doing wrong? Is filling the `mi_fixities` field of the `ModIface` not enough to let importers see the correct fixities?
It seems like the renamer is looking for the fixities via `mi_fix_fn (mi_final_exts iface)`, not `mi_fixities`. You should try to replace: , mi_final_exts = mi_final_exts empty with: , mi_final_exts = (mi_final_exts empty){ mi_fix_fn = mkIfaceFixCache (mi_fixities partial)

Thanks, this works!
I guess this is the kind of problems I run into by using `mkIface_`
directly instead of via `mkIfaceTc`. Unfortunately, if I try that, I end up
with a panic in `GHC.Iface.Recomp.mkHashFun` in my real program (see
separate email earlier).
On Tue, Jul 27, 2021, 16:14 Sylvain Henry
What am I doing wrong? Is filling the `mi_fixities` field of the `ModIface` not enough to let importers see the correct fixities?
It seems like the renamer is looking for the fixities via `mi_fix_fn (mi_final_exts iface)`, not `mi_fixities`.
You should try to replace:
, mi_final_exts = mi_final_exts empty
with:
, mi_final_exts = (mi_final_exts empty){ mi_fix_fn = mkIfaceFixCache (mi_fixities partial)
_______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
participants (3)
-
Erdi, Gergo
-
Gergő Érdi
-
Sylvain Henry