matching type function application with type synonym application
When compiling this module:
{-# LANGUAGE TypeFamilies #-}
type family F a
type family G a
type H a = G a
newtype T0 a = Cons0 (F (G a))
newtype T1 a = Cons1 (F (H a))
f :: T0 Char -> T1 Char
f (Cons0 a) = Cons1 a
I get the type error
MatchTypeFunction.hs:12:21:
Couldn't match expected type ‘F (H Char)’
with actual type ‘F (G Char)’
NB: ‘F’ is a type function, and may not be injective
In the first argument of ‘Cons1’, namely ‘a’
In the expression: Cons1 a
The code works with GHC-7.8 RC2 and GHC-7.4.2, but no longer with GHC-7.8.1. I guess there was some change in how deep GHC resolves type function application and type synonyms.
Trac metadata
Trac field | Value |
---|---|
Version | 7.8.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler (Type checker) |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |