Ticket #2944 (closed merge: fixed)

Opened 4 years ago

Last modified 4 years ago

Mutually recursive equality constraints

Reported by: MartijnVanSteenbergen Owned by: igloo
Priority: normal Milestone:
Component: Compiler (Type checker) Version: 6.10.1
Keywords: Cc:
Operating System: MacOS X Architecture: x86
Type of failure: Difficulty: Unknown
Test Case: indexed-types/should_compile/T2944 Blocked By:
Blocking: Related Tickets:

Description

Given this piece of code:

{-# LANGUAGE TypeFamilies #-}

class C a where
  type T a :: *

f1 :: T a ~ () => a
f1 = f2

f2 :: T a ~ () => a
f2 = f1

GHC complains:

    Couldn't match expected type `T a ~ ()'
           against inferred type `T a1 ~ ()'
    When matching the contexts of the signatures for
      f1 :: forall a. (T a ~ ()) => a
      f2 :: forall a. (T a ~ ()) => a
    The signature contexts in a mutually recursive group should all be identical
    When generalising the type(s) for f1, f2

Is this a bug? Enabling RelaxedPolyRec? fixes the problem. Should TypeFamilies?—just like GADTs—imply RelaxedPolyRec??

Change History

Changed 4 years ago by simonpj

  • owner set to igloo
  • difficulty set to Unknown
  • type changed from bug to merge

I agree:

Tue Jan 13 16:27:16 GMT 2009  simonpj@microsoft.com
  * Make -XTypeFamilies imply -XRelaxedPolyRec (Trac #2944)

It's moot whether we should merge this, but on balance, yes.

Simon

Changed 4 years ago by simonpj

  • testcase set to indexed-types/should_compile/T2944

Changed 4 years ago by igloo

  • status changed from new to closed
  • resolution set to fixed

Merged

Changed 4 years ago by MartijnVanSteenbergen

Thanks. =)

Note: See TracTickets for help on using tickets.