Skip to content

WIP: Control which orphans are warned about

Oleg Grenrus requested to merge phadej/ghc:precise-warn-orphans into master

cc @RyanGlScott

I think there should be flag to reset set of orphans to be empty. I don't know what would be good names for these flags.

Also I'm not sure I do stuff in a proper way, all comments are welcome!

Motivation:

It's common that QuickCheck Arbitrary instances are defined only in the tests. Or that orphan instances are defined in the same package, but not proper module (Internals etc.) Then you could use -forphan-instance=mypkg to be more precise.

I do maintain handful of packages defining orphan instances, and this would allow me to be more precise. E.g. in quickcheck-instances the orphan instances are divided by the package of the type, so I could use -forphan-parent=text in Test.QuickCheck.Instances.Text etc.

Similarly, I'd like this feature to move orphans in Cabal and cabal-install test-suite into proper places. It's easier to make GHC tell me, than to audit by hand. (cabal-install test-suite defines orphan Arbitrary instances, some of which should be defined in Cabal-quickcheck helper package).

There are no tests nor documentation yet. I will write them when the names of flags are decided upon.

Edited by Ben Gamari

Merge request reports