[GHC] #13248: Allow an injective type family RHS to be another injective type family

#13248: Allow an injective type family RHS to be another injective type family -------------------------------------+------------------------------------- Reporter: mniip | Owner: Type: feature | Status: new request | Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 (Type checker) | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Example use case: {{{#!hs {-# 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) }}} 8.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’ }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13248 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13248: Allow an injective type family RHS to be another injective type family -------------------------------------+------------------------------------- Reporter: mniip | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 8.0.1 checker) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): If I recall correctly this is by design. It's explained in [https://www.microsoft.com/en-us/research/publication/injective-type- families-haskell/ Section 4.1 of the paper]. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13248#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13248: Allow an injective type family RHS to be another injective type family
-------------------------------------+-------------------------------------
Reporter: mniip | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler (Type | Version: 8.0.1
checker) |
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari
participants (1)
-
GHC