[GHC] #9433: Partially applied type family allowed but unusable
#9433: Partially applied type family allowed but unusable -------------------------------------+------------------------------------- Reporter: hesselink | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (Type | Version: 7.9 checker) | Operating System: Keywords: | Unknown/Multiple Architecture: Unknown/Multiple | Type of failure: GHC Difficulty: Unknown | accepts invalid program Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- I was playing around with the following code, which tries to map a type family over a type (something I thought would not be allowed): {{{#!hs {-# LANGUAGE TypeFamilies , KindSignatures #-} type family Id x :: * type instance Id a = a type family Map (f :: * -> *) x :: * type instance Map f [a] = [f a] x :: Map Id [Bool] x = [] }}} Both GHC 7.8.3 and the current HEAD (7.9.20140811) accept this program! However, changing the definition of `x` to `[True]` gives an error: {{{ Couldn't match type ‘Id Bool’ with ‘Bool’ Expected type: Map Id [Bool] Actual type: [Bool] In the expression: [True] In an equation for ‘x’: x = [True] }}} If I define `y :: Id Bool` with value `True` (which works fine) and define `x = [y]`, I even get this error: {{{ Couldn't match type ‘Bool’ with ‘Id Bool’ Expected type: Id Bool Actual type: Id Bool In the expression: y In the expression: [y] }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9433> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9433: Partially applied type family allowed but unusable -------------------------------------+------------------------------------- Reporter: hesselink | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.9 (Type checker) | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: GHC | Related Tickets: accepts invalid program | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by Simon Peyton Jones <simonpj@…>): In [changeset:"8ff4671422090acf9146e3a90dd38e2c6f72aebb/ghc"]: {{{ #!CommitTicketReference repository="ghc" revision="8ff4671422090acf9146e3a90dd38e2c6f72aebb" Make Core Lint check for un-saturated type applications Un-saturated type-family and type-synonym applications are detected in the front end, but for some reason Lint wasn't looking for them. I came across this when wondering why Trac #9433 didn't give a Core Lint error }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9433#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9433: Partially applied type family allowed but unusable -------------------------------------+------------------------------------- Reporter: hesselink | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.9 (Type checker) | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: GHC | Related Tickets: accepts invalid program | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by Simon Peyton Jones <simonpj@…>): In [changeset:"ee4501bbad6480509e8a60b5ff89c0b0b228b66d/ghc"]: {{{ #!CommitTicketReference repository="ghc" revision="ee4501bbad6480509e8a60b5ff89c0b0b228b66d" Check for un-saturated type family applications This patch corrects an egregious error introduced by: commit 022f8750edf6f413fba31293435dcc62600eab77 Author: Simon Peyton Jones <simonpj@microsoft.com> Date: Thu May 15 16:07:04 2014 +0100 Refactoring around TyCon.isSynTyCon * Document isSynTyCon better * Add isTypeSyonymTyCon for regular H98 type synonyms * Use isTypeSynonymTyCon rather than isSynTyCon where the former is really intended At this particular spot in TcValidity we really do mean isSynTyCon and not isTypeSynonymTyCon. Fixes Trac #9433 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9433#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9433: Partially applied type family allowed but unusable -------------------------------------+------------------------------------- Reporter: hesselink | Owner: Type: bug | Status: merge Priority: normal | Milestone: Component: Compiler | Version: 7.9 (Type checker) | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: GHC | Related Tickets: accepts invalid program | Test Case: indexed- | types/should_fail/T9433 | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by simonpj): * status: new => merge * testcase: => indexed-types/should_fail/T9433 Comment: Thanks for reporting this. Austin: worth merging `ee4501` if we make 7.8.4 Simon -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9433#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9433: Partially applied type family allowed but unusable -------------------------------------+------------------------------------- Reporter: hesselink | Owner: Type: bug | Status: merge Priority: normal | Milestone: Component: Compiler | Version: 7.9 (Type checker) | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: GHC | Related Tickets: accepts invalid program | Test Case: indexed- | types/should_fail/T9433 | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by rodlogic): Related ticket was closed as a duplicate: #9733 (may contain additional information that is relevant here). -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9433#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9433: Partially applied type family allowed but unusable -------------------------------------+------------------------------------- Reporter: hesselink | Owner: Type: bug | Status: closed Priority: normal | Milestone: 7.8.4 Component: Compiler | Version: 7.9 (Type checker) | Keywords: Resolution: fixed | Architecture: Unknown/Multiple Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: GHC | Related Tickets: accepts invalid program | Test Case: indexed- | types/should_fail/T9433 | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by thoughtpolice): * status: merge => closed * resolution: => fixed * milestone: => 7.8.4 Comment: Merged to `ghc-7.8`. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9433#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC