Skip to content
  • Iavor S. Diatchki's avatar
    Overlapable pragmas for individual instances (#9242) · 6290eead
    Iavor S. Diatchki authored
    Programmers may provide a pragma immediately after the `instance` keyword
    to control the overlap/incoherence behavior for individual instances.
    For example:
    
        instance {-# OVERLAP #-} C a where ...
    
    I chose this notation, rather than the other two outlined in the ticket
    for these reasons:
    
       1. Having the pragma after the type looks odd, I think.
       2. Having the pragma after there `where` does not work for
           stand-alone derived instances
    
    I have implemented 3 pragams:
    
       1. NO_OVERLAP
       2. OVERLAP
       3. INCOHERENT
    
    These correspond directly to the internal modes currently supported by
    GHC.  If a pragma is specified, it will be used no matter what flags are
    turned on.   For example, putting `NO_OVERLAP` on an instance will mark
    it as non-overlapping, even if `OVERLAPPIN_INSTANCES` is turned on for the
    module.
    6290eead