[GHC] #10960: Closed type families don't reduce on data family instances

#10960: Closed type families don't reduce on data family instances -------------------------------------+------------------------------------- Reporter: exFalso | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Keywords: closed type | Operating System: Linux family data | Architecture: x86_64 | Type of failure: GHC rejects (amd64) | valid program Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- The following code doesn't compile: {{{#!hs {-# LANGUAGE TypeFamilies #-} module Tmp where data family D a data instance D () = D type family T a where T () = () T a = Char try :: T (D ()) ~ Char => () try = () main :: IO () main = return try }}} giving {{{ Tmp.hs:15:15: Couldn't match expected type ‘Char’ with actual type ‘T (D ())’ In the first argument of ‘return’, namely ‘try’ In the expression: return try In an equation for ‘main’: main = return try }}} Is this a known limitation of closed type families? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10960 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10960: Closed type families don't reduce on data family instances -------------------------------------+------------------------------------- Reporter: exFalso | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: duplicate | Keywords: closed type | family data Operating System: Linux | Architecture: x86_64 Type of failure: GHC rejects | (amd64) valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by goldfire): * status: new => closed * resolution: => duplicate Comment: It's a bug. Fixed in HEAD and the fix will be in 7.10.3. See #10713. Thanks for reporting! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10960#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10960: Closed type families don't reduce on data family instances -------------------------------------+------------------------------------- Reporter: exFalso | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.10.2 Resolution: duplicate | Keywords: closed type | family data Operating System: Linux | Architecture: x86_64 Type of failure: GHC rejects | (amd64) valid program | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by exFalso): A note to anyone encountering this same problem: There is a weird workaround, at least for the above problem: {{{#!hs type family T a where T () = () T (f a) = Char -- (D ()) reduces here T a = Char }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10960#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC