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

GHC ghc-devs at haskell.org
Sun Jun 19 12:09:18 UTC 2016


#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:  typechecker
      Resolution:                    |  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 Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by rwbarton):

 osa1, the cycle is that ghc thinks you have told it to compile module `P`
 using the plugin `P`. It's not literally an import cycle, but it is a
 dependency cycle of another kind. In your duplicate ticket #12204, ghc
 thinks it has to recompile `Plugin` because of the new command-line flag
 `-fplugin=Plugin`!

 By the way, these examples are illegal according to the documentation,
 which states the "module must be a member of a package registered in GHC’s
 package database".

 > do you mean that GHC should silently ignore the `-fplugin` argument when
 compiling the plugin itself (and its dependencies)?

 What happens if there are multiple `-fplugin` arguments? We can't compile
 each plugin using the other plugins, as that is again a cycle. We could
 compile each plugin using the plugins specified before it on the command
 line, but that seems overly complicated and not necessarily what the user
 wants. Maybe the user wants to compile their program with plugin `A`
 (only), but to compile plugin `A` using plugin `B`. In general there is no
 good reason to think that the flags used to build a plugin should have any
 relation to the flags used to build the program that uses the plugin. In a
 cross-compilation scenario, even the compiler is different!

 I suggest that `ghc --make` should just not follow dependencies to
 plugins. If you want to build a plugin and a program that uses the plugin,
 you need two invocations of `ghc --make`.

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


More information about the ghc-tickets mailing list