Changes between Version 1 and Version 2 of TypeSynonymInstances


Ignore:
Timestamp:
Dec 5, 2005 10:17:22 AM (10 years ago)
Author:
ross@…
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TypeSynonymInstances

    v1 v2  
    66== Brief Explanation ==
    77
     8Haskell 98 permits only type constructors defined using `data` or `newtype` in instance heads.
     9
     10The proposal is to allow type synonyms (fully applied, as ever) in instance heads. These would be fully expanded before any other restrictions on instance heads were checked (see FlexibleInstances and OverlappingInstances).
     11
    812== References ==
    9  * See [http://www.haskell.org/ghc/docs/latest/html/users_guide/type-extensions.html#instance-decls Type synonyms in the instance head] in the GHC's User's Guide.
     13 * [http://www.haskell.org/onlinereport/decls.html#instance-decls Instance declarations] in the Haskell 98 Report
     14 * [http://www.haskell.org/ghc/docs/latest/html/users_guide/type-extensions.html#instance-decls Instance declarations] in the GHC's User's Guide.
    1015
    1116== Pros ==
    12  * Pro
    13  * Pro
     17 * Offered by GHC and Hugs for several years.
     18 * Synonyms can cut large instance heads to a manageable size, e.g. when building a monad using monad transformers.
     19 * Allows a library author to generalize types while retaining source compatibility with old client instances. e.g. replacing
     20   {{{
     21data T a = ...
     22}}}
     23   with
     24   {{{
     25data GenT param a = ...
     26type T = GenT Default
     27}}}
    1428
    1529== Cons ==
    16  * Con
    17  * Con
     30 * Since constraints on the instance head refer to the expanded type, errors can be more obscure.