Opened 6 months ago

Closed 5 months ago

#8500 closed bug (fixed)

Default associated type instances not instantiated

Reported by: goldfire Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.7
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty: Unknown
Test Case: indexed_types/should_compile/T8500 Blocked By:
Blocking: Related Tickets:


I have these modules:

{-# LANGUAGE TypeFamilies #-}

module A where

class C a where
  type F a
  type F a = [a]
{-# LANGUAGE TypeFamilies #-}

module B where

import A

instance C Int where
  type F Int = Double

instance C Bool

When I say ghc A.hs B.hs, all works just fine. But, if I say ghc A.hs and then ghc B.hs, I get this:

    Conflicting family instance declarations:
      F Int -- Defined at B.hs:8:8
      F a1 -- Defined in ‛B’

For some reason, when GHC reads in default type instances from an interface file, it doesn't instantiate them properly when they get used.

This was tested on 7.7.20131031.

Change History (4)

comment:1 Changed 5 months ago by simonpj

Good point. I'm on it.


comment:2 Changed 5 months ago by Simon Peyton Jones <simonpj@…>

In 6f331d69e50f13626b65ab76de408a49caebd4f6/ghc:

Fix marshalling of IfaceAt to and from interface files

I had forgotten about Note [CoAxBranch type variables] in CoAxiom

This patch fixes Trac #8500

comment:3 Changed 5 months ago by Simon Peyton Jones <simonpj@…>

comment:4 Changed 5 months ago by simonpj

  • Resolution set to fixed
  • Status changed from new to closed
  • Test Case set to indexed_types/should_compile/T8500
Note: See TracTickets for help on using tickets.