Changes between Version 5 and Version 6 of DerivedInstances


Ignore:
Timestamp:
Oct 5, 2006 11:09:12 AM (9 years ago)
Author:
ross@…
Comment:

add standalone deriving declaration

Legend:

Unmodified
Added
Removed
Modified
  • DerivedInstances

    v5 v6  
    1212}}}
    1313    as an example.
    14   * Even in the absence of user-defined deriving, it should be easy for a 'newtype' decl to inherit some of the instances of its parent type, no matter where the class was defined, but this is currently only available as a ghc extension to haskell'98.
     14  * Even in the absence of user-defined deriving, it should be easy for a `newtype` declaration to inherit some of the instances of its parent type, no matter where the class was defined, but this is currently only available as a GHC extension to Haskell 98 (see NewtypeDeriving).
    1515
    16 There are various extant proposals to enable the user-specification of the derivation of class instances.
    17   * NewtypeDeriving
     16== User-specified derived instances ==
     17
     18There are various extant proposals to enable the user-specification of the derivation of class instances:
    1819  * PolyP ([http://www.cs.uu.nl/~johanj/publications/notes.ps Jeuring and Jansson], AFP 1996)
    1920  * ghc -fgenerics (Hinze, [http://www.informatik.uni-bonn.de/~ralf/publications/POPL00.ps.gz PoPL 2000], [http://www.informatik.uni-bonn.de/~ralf/publications/HW99.ps.gz Haskell Workshop 1999], [http://www.informatik.uni-bonn.de/~ralf/publications/HW00.ps.gz Haskell Workshop 2000])
     
    2627  * [http://www.generic-haskell.org/ Generic Haskell] preprocessor
    2728  * fill out this list with some more...?
     29
     30== Standalone derived instances ==
     31The development version of GHC adds a top-level declaration on the form:
     32{{{
     33'deriving' qtycls 'for' qtycon
     34}}}
     35which produces the same instance as would be produced by a `deriving` clause in a `data` or `newtype` declaration, but allows this derivation to be decoupled from the datatype declaration, e.g. in another module.