Changes between Version 1 and Version 2 of DataParallel/ClosureConversion/ClassLess


Ignore:
Timestamp:
Apr 20, 2007 1:15:20 PM (8 years ago)
Author:
chak
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DataParallel/ClosureConversion/ClassLess

    v1 v2  
    1414=== Class declarations ===
    1515
     16If we come across a class declaration for a class `C` during conversion, we convert it generating `C_CC`.  Like with type constructors, `Class.Class` gets a `classCC :: Maybe Class` field that is `Just C_CC` for classes that have a conversion.  We also ensure that the `classTyCon` of `C`, let's call it `T_C`, refers to `T_C_CC` and `fr_T_C` and `to_T_C` in its `tyConCC` field, and that the `classTyCon` of `C_CC` is `T_C_CC`.
     17
    1618=== Instance declarations ===
     19
     20If we encounter an instance declaration for `C tau` during conversion, there are two alternatives: we have a conversion for `C` or not:
     21 * if we do not have a conversion, we generate an instance (and hence dfun) for `C tau^`, where `tau^` is the closure converted `tau`;
     22 * if we have a conversion, we generate an instance for `C_CC tau^`.
     23In any case, we add a field `is_CC :: Just Instance` to `InstEnv.Instance` that contains the additionally generated instance.  And in both cases, we should be able to derive the required code for the dfun from the definition of `C tau`.
     24
     25=== Type terms ===
     26
     27We determine the converted type `t^` of `t` as follows:
     28{{{
     29T^            = T_CC , if available
     30                T    , otherwise
     31a^            = a
     32(t1 t2)^      = t1^ t2^
     33(t1 -> t2)^   = Clo t1 t2
     34(forall a.t)^ = forall a.t^
     35(C t1 => t2)^ = C_CC t1^ => t2^ , if available
     36                C t1^ => t2^    , otherwise
     37}}}
     38
     39=== Value bindings ===
     40
     41When converting a toplevel binding for `f :: t`, we generate `f_CC :: t^`.  The alternatives `GlobalId` and `LocalId` of `Var.Var` get a new field `idCC :: Maybe Id` and the `Id` for `f` contains `Just f_CC` in that field.