[GHC] #9433: Partially applied type family allowed but unusable

GHC ghc-devs at haskell.org
Mon Aug 11 18:30:46 UTC 2014


#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


More information about the ghc-tickets mailing list