[GHC] #13262: Allow type synonym family application in instance head if it reduces away

GHC ghc-devs at haskell.org
Fri Feb 10 09:52:34 UTC 2017


#13262: Allow type synonym family application in instance head if it reduces away
-------------------------------------+-------------------------------------
           Reporter:  ezyang         |             Owner:
               Type:  feature        |            Status:  new
  request                            |
           Priority:  lowest         |         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:
-------------------------------------+-------------------------------------
 GHC rejects the following program:

 {{{
 {-# LANGUAGE TypeFamilies, FlexibleInstances #-}
 module F where
 type family F a
 type instance F Int = Int -> Int
 instance Show (F Int) where
     show _ = "fun"
 }}}

 But this doesn't seem fundamentally problematic to me: at the instance
 declaration, we know that F Int will reduce, and after that reduction
 there isn't any problem with the instance.

 Here's a less restrictive instance head test: first, we reduce type
 families as much as possible. Then, if there are still leftover non-
 reducing type families, reject the instance.

 After having typed this up, I have realized that I don't actually need
 this feature. But I'm filing it here for posterity.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13262>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list