Closed Rewbert closed 4 months ago
I need to leave for the day now, but I managed to narrow it down to the call to impossible
in getAssocs
, in Typecheck.hs
.
Is it compiling the boot file for Data.Typeable or the real module? I suspect that after compiling the boot file, some invariant might be violated. Try only printing for the real file.
You probably don't want to print when compiling a boot file anyway, since the real module will appear later.
Hm right, it is indeed the boot module throwing this error. What is the purpose of these modules, in contrast to the real module?
Same purpose as for GHC: to break cyclic import chains. Check out the GHC documentation, it works the same way.
I'm closing this, since it was an issue with boot imports.
I am trying to compile a very silly module
If I derive
Show
forTypeExport
andValueExport
and add a functiontTypeExports
to get the[TypeExport]
out of aTModule a
, and then try to print them inCompile.hs
, the compiler crashes with animpossible
error.Directly after the call to
typeCheck
in the functioncompileModule
, I addliftIO $ putStrLn $ show $ tTypeExports tmdl
. The compiler recursively compiles modules that are needed to compile the current one, and only when it reaches the moduleData.Typeable
does this line produce this error. If I guard the print statement to only fire when the module is not calledData.Typeable
, there are no problems.Maybe some problem with laziness, and the print statement forces some problem to manifest? The commit pushing the diff compared to your master, to trigger this bug, is here: https://github.com/Rewbert/MicroHs/commit/4ce90ddacdde5d31560167bbda3d373220a54940