Opened 11 months ago

Last modified 10 days 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:

Description

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 11 months ago by simonpj

Keywords: TypeInType added

comment:2 Changed 6 weeks ago by goldfire

This is fixed now. Will add a regression test.

comment:3 Changed 10 days 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.