A patch to run Template Haskell code in a forked thread was included in ghc-8.10.6: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/5042
This was chosen as the only robust way to avoid reporting any asynchronous exceptions thrown to the compilation process during TH evaluation as a user error in TH code. If you cancel a compile by throwing the compilation thread an exception, we don't want to catch that error in GHC and report it as if the TH code had a regular exception. By running the TH code in a forked thread and not sharing the ThreadId, we ensure that any exception caught during the evaluation of TH code either originated from the code itself or was thrown by the RTS directly to the TH code (BlockedIndefinetelyOnMVar,... etc.). There may be alternative solutions to this or ways to make this behaviour configurable. I would urge you to open an ticket on the GHC tracker detailing your use case. On 21/11/16 11:26, Domínguez, Facundo wrote:
Dear devs, I found recently that ghc-8.10.6 and ghc-8.10.7 might be behaving differently than previous compilers when running Template Haskell code. When upgrading HaskellR to use a newer ghc I found that it would work fine with ghc-8.10.4, but not ghc-8.10.6 or ghc-8.10.7. HaskellR, and the R runtime in particular, is sensitive to local state in the threads that are used to execute the runtime. HaskellR is arranging to run the R runtime when running TemplateHaskell splices, and this stopped working in MacOS with ghc-8.10.6. The error I got is not new. It comes from R and we would get it in ghci if we try to use HaskellR without passing the command line flag -fno-ghci-sandbox. But this is the first time we get the error when using TemplateHaskell. Does anyone know if there have been changes to the threads in which the TH splices are run? And were there any changes specific to TH in MacOS? Thanks in advance, Facundo [1] https://github.com/tweag/HaskellR/pull/368#issuecomment-968864170
_______________________________________________ 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