Allow an injective type family RHS to be another injective type family
Example use case:
{-# LANGUAGE TypeFamilies, TypeFamilyDependencies, UndecidableInstances #-}
type family Foo a = r | r -> a where
Foo Int = Char
Foo Integer = String
type family Bar a = r | r -> a where
Bar Char = Double
Bar String = Float
type family Baz a = r | r -> a where
Baz x = Bar (Foo x)
- 0 says:
test.hs:12:9: error:
• Type family equation violates injectivity annotation.
RHS of injective type family equation cannot be a type family:
Baz x = Bar (Foo x) -- Defined at test.hs:12:9
• In the equations for closed type family ‘Baz’
In the type family declaration for ‘Baz’
Trac metadata
Trac field | Value |
---|---|
Version | 8.0.1 |
Type | FeatureRequest |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler (Type checker) |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |