Changes between Version 26 and Version 27 of DataParallel/ClosureConversion/ClassLess


Ignore:
Timestamp:
Apr 30, 2007 4:30:39 AM (7 years ago)
Author:
chak
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DataParallel/ClosureConversion/ClassLess

    v26 v27  
    2424data a :<->: b = (:<->:) {to :: a -> b, fr ::b -> a} 
    2525}}} 
     26The functions witness the isomorphism between the two representations, as usual. 
    2627 
    2728=== Converting type declarations === 
     
    6465data a :-> b = forall e. !(e -> a -> b) :$ e 
    6566 
    66 isoArr :: a :<->: a_CC -> b :<->: b_CC -> (a -> b) :<->: (a_CC :-> b_CC) 
     67isoArr :: a :<->: a_CC   -- argument conversion 
     68       -> b :<->: b_CC   -- result conversion 
     69       -> (a -> b) :<->: (a_CC :-> b_CC) 
    6770isoArr (toa :<->: fra) (tob :<->: frb) = toArr :<->: frArr 
    6871  where 
     
    7073    frArr (f :$ e) = frb . f e . toa 
    7174}}} 
     75So, the function array constructor `(->)::*->*->*` has a `tyConCC` field with value `ConvCC ((:->), isoArr)`. 
     76 
     77Closure application is defined as 
     78{{{ 
     79($:) :: (a :-> b) -> a -> b 
     80(f :$ e) $: x = f e x 
     81}}} 
    7282 
    7383==== Conversion rules ==== 
     
    7585If 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: 
    7686 * 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.) 
    7788 * 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.) 
    7989 * Otherwise, we generate a converted type declaration `T_CC` together a conversion constructor  `isoT`, and set `tyConCC` to `ConvCC (T_CC, isoT)`. 
    8090Note that basic types, such as `Int` and friends, should have `tyConCC` set to `ConvCC (Int, isoInt)` with identity conversions `isoInt = id :<->: id`.