Skip to content

Inaccessible equations in a closed type family should be a warning, not an error

If I say

foo _     = ()
foo False = ()

I get

/Users/rae/temp/Bug.hs:2:1: Warning:
    Pattern match(es) are overlapped
    In an equation for ‘foo’: foo False = ...

But, if I say

{-# LANGUAGE TypeFamilies #-}

type family Foo a where
  Foo x    = ()
  Foo Bool = ()

I get

/Users/rae/temp/Bug.hs:5:3:
    Inaccessible family instance equation:
      Foo Bool = ()
    In the equations for closed type family ‘Foo’
    In the type family declaration for ‘Foo’

If this issues a warning at the term level, it probably should do the same at the type level.

This was my design decision that I'm changing, and I will fix. The warning will be controlled by the same flag that controls the term-level version.

Trac metadata
Trac field Value
Version 7.8.2
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