Changes between Version 2 and Version 3 of LiberalTypeSynonyms


Ignore:
Timestamp:
Apr 23, 2008 7:06:54 AM (7 years ago)
Author:
simonpj@…
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • LiberalTypeSynonyms

    v2 v3  
    66See the [http://www.haskell.org/ghc/docs/latest/html/users_guide/type-extensions.html#type-synonyms GHC Documentation] on this extension. 
    77 
    8 The basic idea is that type validity checking is done ''after expanding type synonyms''.  This means that type synonyms can be written unsaturated, as long as the result of expanding synonyms leaves everything saturated.  This is sometimes quite useful. 
     8The basic idea is that type validity checking is done ''after expanding type synonyms''.  
     9This means, for example, that type synonyms can be written unsaturated, as long as the result of expanding synonyms leaves everything saturated.  This is sometimes quite useful. 
    910 
    1011There are also interactions with [wiki:RankNTypes] - a type synonym may expand to a quantified type. 
     
    1213== Proposal == 
    1314 
    14 Adopt GHC's approach to type synonym expansion. 
     15Adopt GHC's approach to type synonym expansion. Specifically, these conditions are checked only ''after'' expansion: 
     16  * No partial applications of type synonyms 
     17  * No 'forall' types as an argument to a type constructor 
     18  * An instance head is of form `C (T ...)`, where `T` is a ''data'' type. 
     19However these conditions may be broken ''before'' expansion of type synonyms. 
    1520 
    16 == Design choices == 
     21== Kind checking == 
    1722 
    18 Should kind inference be done before, or after expanding type synonyms?  That is, should a type synonym have a fixed kind or not? 
     23Should kind checking be done before, or after expanding type synonyms?  That is, should a type synonym have a fixed kind or not? 
    1924 
    2025Currently GHC does kind inference before expanding type synonyms, and gives each type synonym a fixed kind.  The following program is rejected: