Changes between Version 11 and Version 12 of DataParallel/ClosureConversion/ClassLess


Ignore:
Timestamp:
Apr 23, 2007 10:43:26 AM (8 years ago)
Author:
chak
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DataParallel/ClosureConversion/ClassLess

    v11 v12  
    2020=== Converting type declarations ===
    2121
    22 If a type declaration for constructor `T` occurs in a converted module, we
    23 (1) generate a converted type declaration `T_CC` together two conversion functions `fr_T` and `to_T`, and
    24 (2) store these three names in the representation of `T`.
    25 Concerning Point (2), more precisely the alternatives of `TyCon.TyCon` get a new field `tyConCC :: Maybe (TyCon, Id, Id)`.  This field is `Nothing` for data constructors for which we have no conversion and `Just (T_CC, fr_T, to_T)` if we have a conversion.
     22==== Preliminaries ====
    2623
    27 Incidentally, if during conversion we come across a type declaration that we don't know how to convert (as it uses fancy extensions), we just don't generate a conversion.
     24The alternatives of `TyCon.TyCon` get a new field `tyConCC :: StatusCC (TyCon, Id, Id)`.  This field is `NoCC` for data constructors for which we have no conversion, `AsIsCC` if the original and the converted form coincide, and `ConvCC (T_CC, fr_T, to_T)` if we have a converted form.
    2825
    29 Note that basic types, such as `Int` and friends, would have `tyConCC` set to `Nothing`, which is exactly what we want.
     26Moreover, we have a type constructor `(-->)` that represents closures and we assume that the field `tyConCC` of `(->)` has the value `ConvCC ((-->), fr_fun, to_fun)`, where `fr_fun` and `to_fun` are appropriate conversion functions.
     27
     28==== Conversion rules ====
     29
     30If a type declaration for constructor `T` occurs in a converted module, we need to decide whether to convert the declaration of `T`.  We decide this as follows:
     31 * If the declaration of `T` mentions another type constructor `S` and we have `tyConCC S == NoCC`, we do not convert `T` and set its `tyConCC` field to `NoCC` as well.
     32 * If the declaration of `T` uses any features that we cannot (or for the moment, don't want to) convert, we do not convert `T` and set its `tyConCC` field to `NoCC`.
     33 * If all type constructors `S` mentioned in `T`'s definiton have `tyConCC S == AsIsCC`, we do not convert `T` and set its `tyConCC` field to `AsIsCC` as well.  (NB: This implies that `T` does not mention any function arrows.)
     34 * Otherwise, generate a converted type declaration `T_CC` together two conversion functions `fr_T` and `to_T`, and set
     35`tyConCC` to `ConvCC (T_CC, fr_T, to_T)`.
     36Note that basic types, such as `Int` and friends, should have `tyConCC` set to `AsIsCC`.
    3037
    3138=== Converting class declarations ===