[GHC] #10077: Providing type checker plugin on command line results in false cyclic import error

GHC ghc-devs at haskell.org
Tue Feb 10 13:07:25 UTC 2015


#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 jbracker):

 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
 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?

 > I guess we should make the documentation clearer about how to avoid this
 problem, and perhaps change the cyclic import message to be more
 informative in the presence of plugins.

 Yes, I agree. Thank you for extending the wiki page!

 > Regarding `-dynamic`, I guess we should do something similar to #8180,
 since it's basically the same issue: if you use `-fplugin MyPlugin`
 anywhere in the module graph, the compilation manager should make sure
 that `MyPlugin` is compiled with `-dynamic` or `-dynamic-too`. I don't
 know how tricky this would be to implement, though.

 Looking at the changes from that ticket it does not seem to be too much
 work: [changeset:"e25af05656b496b997c8f3520e5ac8e377a68e7b/ghc"]
 Though there might be lingering problems arising from this.

 Replying to [comment:3 adamgundry]:
 > I've added a [wiki:Plugins/TypeChecker#FAQ section to the typechecker
 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?

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10077#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list