Skip to content

Eta reduce type synonyms when possible

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.)

Trac metadata
Trac field Value
Version 8.1
Type FeatureRequest
TypeOfFailure OtherFailure
Priority lowest
Resolution Unresolved
Component Compiler (Type checker)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC goldfire
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information