<div dir="ltr">Dear devs,<div><br></div><div>I'm confused about the meaning of -hidir and -i. Here's my experiment with both ghc-9.2.0 and ghc-8.10.4.</div><div><br></div><div>> $ find</div><div>> ./Main.hs<br>> ./lib/Lib.hs</div><div>></div><div>> $ ghc -dynamic-too -c lib/Lib.hs -odir odir -hidir hidir_Lib</div><div>></div><div>> $ ghc -dynamic-too -c Main.hs -odir odir -ihidir_Lib -hidir hidir_Main</div><div>></div><div>> Main.hs:3:1: error:<br>>     Bad interface file: hidir_Main/Lib.hi<br>>         hidir_Main/Lib.hi: openBinaryFile: does not exist (No such file or directory)<br>>   |<br>> 3 | import Lib<br>>   | ^^^^^^^^^^<br></div><div><br></div><div>If I only use -hidir, it still fails with another error</div><div><br></div><div>> $ ghc -dynamic-too -c Main.hs -odir odir -hidir hidir_Lib</div>><br>> Main.hs:7:29: error: Variable not in scope: f<br>>   |<br>> 7 | main = print $(runIO (print f) >> [| True |])<br>>   |                             ^<br><div><br></div><div>If I use both -i and -hidir pointing to the same folder, then it works!</div><div><br></div><div>> $ ghc -dynamic-too -c Main.hs -odir odir -ihidir_Lib -hidir hidir_Lib<br></div><div><br></div><div>Now, is this behavior a bug or a feature? And if it is a bug, what is the expected behavior?</div><div><br></div><div>Programs copied below.</div><div><br></div><div>Thank you!</div><div>Facundo</div><div><br></div><div>> $ cat lib/Lib.hs<br>> module Lib where<br>><br>> f :: Int<br>> f = 1<br></div><div>></div><div>> $ cat Main.hs<br>> {-# LANGUAGE TemplateHaskell #-}<br>><br>> import Lib<br>> import <a href="http://language.haskell.th/" target="_blank">Language.Haskell.TH</a><br>><br>> main :: IO ()<br>> main = print $(runIO (print f) >> [| True |])</div></div>