Skip to content

Weird import cycle when using plugins

Here's a demo:

$ ghc Plugin.hs
[1 of 1] Compiling Plugin           ( Plugin.hs, Plugin.o )
$ ghc Main.hs
[1 of 1] Compiling Main             ( Main.hs, Main.o )
Linking Main ...


$ rm Main.hi Main.o
$ ghc Main.hs -fplugin=Plugin
Module imports form a cycle:
  module ‘Plugin’ (./Plugin.hs) imports itself


$ cat Plugin.hs
module Plugin (plugin) where

plugin = undefined

$ cat Main.hs
module Main (main) where

main :: IO ()
main = return ()

Tried with 8.0.1, HEAD.

I don't know why installing plugins using Cabal works but this doesn't. I can't add plugin tests because of this.

I can try fixing this myself if someone points me to the right direction -- I have no idea which part of the compiler could be doing this.

Trac metadata
Trac field Value
Version 8.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information