Skip to content

Make GHC handle orphan COMPLETE sets of conlikes better

Like orphan rewrite rules, it's possible to define orphan COMPLETE sets. For instance:

module Foo where

{-# COMPLETE False #-}

I suppose that we could define an orphan COMPLETE set as one that lives in a module where none of the conlikes are defined (or should we say "where one or more of the conlikes are not defined"? I'm not sure.)

Like orphan RULES, orphan COMPLETE sets are important to track properly when transitively reading from interface files, as failing to bring an orphan COMPLETE set into scope could affect pattern-match exhaustivness warnings that users see.

After discussing this with rwbarton and mpickering IRC, we decided that one of the two should happen:

  1. Treat orphan COMPLETE sets like orphan RULES. That is, mark a module as an orphan if it defines an orphan COMPLETE set, and thread a "COMPLETE pragma visibility" state through various places.
  2. Disallow orphan COMPLETE sets entirely.
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 mpickering
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information