Changes between Version 42 and Version 43 of Commentary/Compiler/GenericDeriving


Ignore:
Timestamp:
Dec 14, 2011 12:01:16 PM (2 years ago)
Author:
dreixel
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/Compiler/GenericDeriving

    v42 v43  
    4040= Kind polymorphic overhaul = 
    4141 
    42 Work in progress. 
     42The current implementation supports defining both functions over types of kind `*` (such as `show`) and functions over types of kind `* -> *` (such as `fmap`). Although care has been taken to reduce code duplication, we still need two generic classes, one for each kind (`Generic` and `Generic1`). 
     43 
     44With the new `-XPolyKinds` functionality, we can make the support for generic programming better typed and more general. The basic idea is to define the universe codes (`M1`, `:+:`, etc.) as constructors of a datatype. Promotion then lifts these constructors to types, which we can use as before, only that now we have them all classified under a new kind: 
     45{{{ 
     46data Universe x = U 
     47                | K x 
     48                | P Nat 
     49                | Universe x :+: Universe x 
     50                | Universe x :*: Universe x 
     51                | M MetaData (Universe x) 
     52 
     53data MetaData = C | D | S 
     54}}}