Opened 5 months ago

Closed 5 months ago

#8548 closed bug (fixed)

Coercible does not resolve type family application

Reported by: nomeata Owned by: nomeata
Priority: normal Milestone:
Component: Compiler (Type checker) Version: 7.6.3
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty: Unknown
Test Case: Blocked By:
Blocking: #8503 Related Tickets: #8503

Description

With GND implemented using Coercible (See #8503) the test for #4185 fails. A minimal example is:

{-# LANGUAGE TypeFamilies #-}
module CoerceNewtypeFamily where
import GHC.Exts
data family Foo k
newtype instance Foo Int = FooInt Int 
x :: Foo Int -> Int
x = coerce

yielding

[1 of 1] Compiling CoerceNewtypeFamily ( CoerceNewtypeFamily.hs, CoerceNewtypeFamily.o )

CoerceNewtypeFamily.hs:11:5:
    No instance for (Coercible (Foo Int) Int)
      because ‛Foo Int’ and ‛Int’ are different types.
      arising from a use of ‛coerce’
    In the expression: coerce
    In an equation for ‛x’: x = coerce

I guess the Coercible finding code needs to simply type family equations if possible.

Change History (7)

comment:1 Changed 5 months ago by nomeata

  • Blocking 8503 added

comment:2 Changed 5 months ago by nomeata

(Also breaks the test case for #5955, #2856 and test case DerivingNewType)

comment:3 Changed 5 months ago by nomeata

(You can add #2850 to that list, it seems)

comment:4 Changed 5 months ago by nomeata

Fixed (not yet pushed), solves all listed tickets.

comment:5 Changed 5 months ago by Joachim Breitner <mail@…>

In 335031f0cbc03a8d3ba893b0dabb71088665e748/ghc:

Extend Coercible to newtype instances

This fixes: #8548

comment:6 Changed 5 months ago by Joachim Breitner <mail@…>

In 8949a7cc453a7aec9bbcb752a07c140c2f15a619/testsuite:

Testcase for Coercible and newtype families (#8548)

comment:7 Changed 5 months ago by nomeata

  • Resolution set to fixed
  • Status changed from new to closed

This has hit master together with the changes for #8503, closing.

Note: See TracTickets for help on using tickets.