
Replying to [comment:2 adamgundry]:
This is arguably correct behaviour, though I agree that it's less than ideal. The combination of `--make` and `-fplugin` is often troublesome, because `-fplugin MyPlugin` essentially imports `MyPlugin` in every module being compiled.
I have trouble understanding why a plugin needs to be imported to the module that uses it. As far as I understand GHC dynamically loads the
I've added a [wiki:Plugins/TypeChecker#FAQ section to the typechecker
#10077: Providing type checker plugin on command line results in false cyclic import error -------------------------------------+------------------------------------- Reporter: jbracker | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 7.11 checker) | Keywords: Resolution: | typechecker plugin cycle imports Operating System: Linux | Architecture: x86_64 Type of failure: Incorrect | (amd64) warning at compile-time | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by adamgundry): Replying to [comment:4 jbracker]: plugin module and uses it, but I don't see why the plugin needs to be imported to the compiled module, since the modules do not have access to the plugins functionality anyway. Is this required because the plugin might import other modules in scope? Or is there some other technical reason? To try to clarify: it's not exactly true that the plugin needs to be **imported** into a module that uses it, although I believe the implementation works more-or-less like that, with some cleverness to avoid e.g. typeclass instances being brought in. The point is that if module `M` uses a plugin in module `P`, then we have to dynamically load `P` in order to typecheck `M`. Hence `P` cannot depend (directly or indirectly) on `M`! When `-fplugin=P` is used on the command-line, GHC tries to load `P` for every module being compiled, which might include `P` itself. This isn't exactly a cyclic import, but it's pretty close. plugins wiki page] documenting these issues. Suggestions for improvement are welcome!
Maybe a link to this ticket, in case someone wants to know more about
the issue? Yes. Done. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10077#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler