Opened 9 years ago

Closed 9 years ago

#4246 closed bug (fixed)

"Conflicting family instance declarations" error mentions code I did not write

Reported by: TillmannRendel Owned by:
Priority: normal Milestone: 7.4.1
Component: Compiler Version: 6.12.1
Keywords: Cc: rendel@…, p.giarrusso@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: indexed-types/should_fail/T4246
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


I get an error message mentioning code that I did not write but results from desugaring when compiling the following program:

{-# LANGUAGE TypeFamilies, FlexibleInstances, OverlappingInstances #-}

class Stupid a where
  type F a

instance Stupid a where
  type F a = a

instance Stupid Int where
  type F Int = Bool

The error I get is:

    Conflicting family instance declarations:
      type instance F a -- Defined at families.hs:7:7
      type instance F Int -- Defined at families.hs:10:7

The error mentions "type instance F a", but it should say "type F a", because that is what I wrote in the source file. Or maybe "type F a in instance Stupid a" to make it clear that it's an instance declaration.

Change History (3)

comment:1 Changed 9 years ago by Blaisorblade

Cc: p.giarrusso@… added

comment:2 Changed 9 years ago by igloo

Milestone: 6.16.1

Thanks for the report

comment:3 Changed 9 years ago by simonpj

Resolution: fixed
Status: newclosed
Test Case: indexed-types/should_fail/T4246

Your (very resonable) request pushed me over the top to doing a significant re-organisation of TyCon.lhs. But then it was easy:

Wed Sep 15 05:32:19 PDT 2010
  * Improve pretty-printing of family instances
  Fixed Trac #4246

    M ./compiler/types/FamInstEnv.lhs -8 +16

So it's done.


Note: See TracTickets for help on using tickets.