Opened 16 months ago

Last modified 5 months ago

#12742 new bug

Instantiation of invisible type family arguments is too eager

Reported by: goldfire Owned by: goldfire
Priority: normal Milestone:
Component: Compiler Version: 8.0.1
Keywords: TypeInType Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: GHC rejects valid program Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


This module looks, to me, like it should be accepted:

{-# LANGUAGE TypeInType, RankNTypes, TypeFamilies #-}

module Bug where

import Data.Kind

type family F :: forall k2. (k1, k2)

data T :: (forall k2. (Bool, k2)) -> Type

type S = T F

But it's not. The problem is that TcHsType.handle_tyfams eagerly instantiates all invisible arguments to a type family at every occurrence. Instead, it should instantiate only those that are counted in the TF's arity -- that is, those "before the colon".

Will fix.

Change History (3)

comment:1 Changed 16 months ago by simonpj

Keywords: TypeInType added

comment:2 Changed 6 months ago by goldfire

This is fixed now. Will add a regression test.

comment:3 Changed 5 months ago by Ben Gamari <ben@…>

In c813d8c9/ghc:

Regression test for #12742

Location: dependent/should_compile/T12742
Note: See TracTickets for help on using tickets.