Skip to content

Spurious warning with new associated types and MultiParamTypeClasses

Consider this program:

{-# LANGUAGE TypeFamilies, MultiParamTypeClasses #-}
module Overlap where

class Foo a b where
  type Typ a

instance Foo Int Int where
  type Typ Int = Bool

instance Foo Int Bool where

We get a warning:

Overlap.hs:10:1:
    Warning: No explicit AT declaration for `Typ'
    In the instance declaration for `Foo Int Bool'

But inserting such an AT declaration would be an error!

Overlap.hs:8:8:
    Conflicting family instance declarations:
      type Typ Int -- Defined at Overlap.hs:8:8
      type Typ Int -- Defined at Overlap.hs:11:8
Trac metadata
Trac field Value
Version 7.3
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