patch applied (ghc): Deriving for indexed data types

[email protected]
Newsgroups gmane.comp.lang.haskell.cvs.all
Message-ID <20061218213222.GA22425__4156.30248976431$1166477616$gmane$org@cvs.haskell.org>
Mon Dec 18 13:12:05 PST 2006  Manuel M T Chakravarty <[email protected]>
  * Deriving for indexed data types
  - This patch implements deriving clauses for data instance declarations
    (toplevel and associated)
  - Doesn't support standalone deriving.  This could be easily supported,
    but requires an extension of the syntax of standalone deriving clauses.
    Bj[_\c3_][_\b6_]rn, fancy adding this?
  - We cannot derive Typeable.  This seems a problem of notation, more than 
    anything else.  Why?  For a binary vanilla data type "T a b", we would 
    generate an instance Typeable2 T; ie, the instance is for the constructor
    alone.  In the case of a family instance, such as (S [a] (Maybe b)), we
    simply have no means to denote the associated constuctor.  It appears to
    require type level lambda - something like (/\a b. S [a] (Maybe b).
  - Derivings are for *individual* family *instances*, not for entire families.
    Currently, I know of no simple translation of class instances for entire 
    families to System F_C.  This actually seems to be similar to implementing
    open data types [_\c3_][_\a0_] la L[_\c3_][_\b6_]h & Hinze.
  - This patch only covers data types, not newtypes.

    M ./compiler/typecheck/TcDeriv.lhs -59 +111
    M ./compiler/typecheck/TcEnv.lhs -1 +19
    M ./compiler/types/FamInstEnv.lhs -2 +46
    M ./compiler/types/Type.lhs +8
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.