Changes between Version 26 and Version 27 of DataParallel/ClosureConversion/ClassLess
 Timestamp:
 Apr 30, 2007 4:30:39 AM (8 years ago)
Legend:
 Unmodified
 Added
 Removed
 Modified

DataParallel/ClosureConversion/ClassLess
v26 v27 24 24 data a :<>: b = (:<>:) {to :: a > b, fr ::b > a} 25 25 }}} 26 The functions witness the isomorphism between the two representations, as usual. 26 27 27 28 === Converting type declarations === … … 64 65 data a :> b = forall e. !(e > a > b) :$ e 65 66 66 isoArr :: a :<>: a_CC > b :<>: b_CC > (a > b) :<>: (a_CC :> b_CC) 67 isoArr :: a :<>: a_CC  argument conversion 68 > b :<>: b_CC  result conversion 69 > (a > b) :<>: (a_CC :> b_CC) 67 70 isoArr (toa :<>: fra) (tob :<>: frb) = toArr :<>: frArr 68 71 where … … 70 73 frArr (f :$ e) = frb . f e . toa 71 74 }}} 75 So, the function array constructor `(>)::*>*>*` has a `tyConCC` field with value `ConvCC ((:>), isoArr)`. 76 77 Closure application is defined as 78 {{{ 79 ($:) :: (a :> b) > a > b 80 (f :$ e) $: x = f e x 81 }}} 72 82 73 83 ==== Conversion rules ==== … … 75 85 If 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: 76 86 * 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. 87 * If all type constructors `S` that are mentioned in `T`'s definiton have `tyConCC S == ConvCC S`, we do not convert `T` and set its `tyConCC` field to `ConvCC (T, isoT)` generating a suitable conversion constructor `isoT`. (NB: This implies that `T` does not mention any function arrows.) 77 88 * 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`. 78 * If all type constructors `S` mentioned in `T`'s definiton have `tyConCC S == ConvCC S`, we do not convert `T` and set its `tyConCC` field to `ConvCC (T, isoT)` generating a suitable conversion constructor `isoT`. (NB: This implies that `T` does not mention any function arrows.)79 89 * Otherwise, we generate a converted type declaration `T_CC` together a conversion constructor `isoT`, and set `tyConCC` to `ConvCC (T_CC, isoT)`. 80 90 Note that basic types, such as `Int` and friends, should have `tyConCC` set to `ConvCC (Int, isoInt)` with identity conversions `isoInt = id :<>: id`.