SOLVED: GHC 9.3 API panics with "No home unit"

Simon Peyton Jones simonpj at microsoft.com
Wed Sep 29 08:06:16 UTC 2021


Norman,

I'm glad you are unstuck.

We badly need a bird's eye view of the GHC API, with chapters about specific bits. It shouldn't be a question of trial an error.  But it evolved rather than being designed, and since then everyone's shortest path to completion is simply to find a way through and execute on it.

If you felt able to write down what you have learned, we could make it part of GHC's user manual, and improve it incrementally.   I know that's not on your shortest path to completion either, but you have particularly superior writing skills, and I think you might find that others join in if you took the lead.

Also then you could say "but why do you need to do getSession not newHscEnv, and we might be able to fill in some of the rationale rather than just write down cookbook recipes.  And it might lead to design changes too, I hope.

Posting here in the hope that others say "oh yes, I'd love to help with that"! 

Simon


PS: I am leaving Microsoft at the end of November 2021, at which point simonpj at microsoft.com will cease to work.  Use simon.peytonjones at gmail.com instead.  (For now, it just forwards to simonpj at microsoft.com.)

|  -----Original Message-----
|  From: ghc-devs <ghc-devs-bounces at haskell.org> On Behalf Of Norman
|  Ramsey
|  Sent: 29 September 2021 00:36
|  Cc: ghc-devs at haskell.org
|  Subject: SOLVED: GHC 9.3 API panics with "No home unit"
|  
|   > The code worked in the 9.0 API, but using the 9.3 API causes a
|  panic:
|   >
|   >   sandbox: panic! (the 'impossible' happened)
|   >     GHC version 9.3.20210918:
|   >           unsafeGetHomeUnit: No home unit
|  
|  SOLVED: I was getting an `HscEnv` by using `newHscEnv` with a
|  `DynFlags`.
|  Turns out I'm not supposed to do that; using `getSession` instead
|  solved the problem.  Thanks to Cheng Shao for the diagnosis!
|  
|  If there is something I can read to help me avoid similar mistakes in
|  the future, please point me in its direction!
|  
|  
|  Norman
|  _______________________________________________
|  ghc-devs mailing list
|  ghc-devs at haskell.org
|  https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmail.
|  haskell.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fghc-
|  devs&data=04%7C01%7Csimonpj%40microsoft.com%7C96b747b71fd6484be28c
|  08d982d8f526%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637684691082
|  936473%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJ
|  BTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=A4Mw547%2FzPS1w6WZ%2BkR11
|  f%2F5GMxccIUOqcCPjvIRXVk%3D&reserved=0


More information about the ghc-devs mailing list