Opened 2 years ago

Closed 6 months ago

#12742 closed bug (fixed)

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: dependent/should_compile/T12742
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 (4)

comment:1 Changed 2 years ago by simonpj

Keywords: TypeInType added

comment:2 Changed 13 months ago by goldfire

This is fixed now. Will add a regression test.

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

In c813d8c9/ghc:

Regression test for #12742

Location: dependent/should_compile/T12742

comment:4 Changed 6 months ago by RyanGlScott

Resolution: fixed
Status: newclosed
Test Case: dependent/should_compile/T12742

As noted in comment:2 and comment:3, this has been fixed, and a regression test has been added.

Note: See TracTickets for help on using tickets.