[GHC] #12701: Eta reduce type synonyms when possible

GHC ghc-devs at haskell.org
Fri Oct 14 03:09:13 UTC 2016


#12701: Eta reduce type synonyms when possible
-------------------------------------+-------------------------------------
           Reporter:  ezyang         |             Owner:
               Type:  feature        |            Status:  new
  request                            |
           Priority:  lowest         |         Milestone:
          Component:  Compiler       |           Version:  8.1
  (Type checker)                     |
           Keywords:  backpack       |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 If you can eta reduce a type synonym, it is always better:

 {{{
 -- Bad
 type F a = Maybe a
 instance Functor F -- illegal, partially applied type synonym!
 -- Good
 type F = Maybe
 instance Functor F -- ok with type synonym instances
 }}}

 So... GHC should do this automatically for users. Ordinarily this is not
 terribly important (thus the priority); in the context of #12680 it is a
 modestly helpful affordance which allows a user to implement `data Map a`
 using `type Map a = HashMap a` (signature matching requires the type
 synonym to be nullary.)

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


More information about the ghc-tickets mailing list