Opened 18 months ago

Closed 18 months ago

Last modified 6 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 Test Case: typecheck/should_run/TcCoercible
Blocked By: Blocking: #8503
Related Tickets: #8503 Differential Revisions:

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 (8)

comment:1 Changed 18 months ago by nomeata

  • Blocking 8503 added

comment:2 Changed 18 months ago by nomeata

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

comment:3 Changed 18 months ago by nomeata

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

comment:4 Changed 18 months ago by nomeata

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

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

In 335031f0cbc03a8d3ba893b0dabb71088665e748/ghc:

Extend Coercible to newtype instances

This fixes: #8548

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

In 8949a7cc453a7aec9bbcb752a07c140c2f15a619/testsuite:

Testcase for Coercible and newtype families (#8548)

comment:7 Changed 18 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.

comment:8 Changed 6 months ago by goldfire

  • Test Case set to typecheck/should_run/TcCoercible
Note: See TracTickets for help on using tickets.