Changes between Version 52 and Version 53 of DataParallel/ClosureConversion/ClassLess
- Timestamp:
- 04/30/07 23:58:16 (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
DataParallel/ClosureConversion/ClassLess
v52 v53 134 134 ==== Conversion constructor ==== 135 135 136 Whenever , we set`T_CC`, we also need to generate a conversion constructor `isoT`. If `T` has one or more arguments, the conversion is non-trivial, even for `T_CC == T`.136 Whenever we have a converted type constructor `T_CC`, we also need to generate a conversion constructor `isoT`. If `T` has one or more arguments, the conversion is non-trivial, even for `T_CC == T`. 137 137 138 138 ==== Converting data constructors ==== 139 139 140 We convert data constructors by converting their argument types and their representation `DataCon` gets a new filed `dcCC :: StatusCC DataCon`. In particular, the signature of the worker is converted. However, in contrast to other functions, we only convert the argument and result types; the arrows tying them together are left intact. For example, if the original wrapper has the type signature140 We convert a data constructor `C :: t1 -> ... -> tn` by generating a converted constructor `C_CC :: t1^ -> .. -> tn^`. This includes the generation of a corresponding new worker `Id`. For example, if the original worker has the type signature 141 141 {{{ 142 142 MkT :: (Int -> Int) -> Int 143 143 }}} 144 the converted w rapper is144 the converted worker is 145 145 {{{ 146 146 MkT_CC :: (Int :-> Int) -> Int 147 147 }}} 148 As a consequence, whenever we convert a ''partial'' wrapper application in an expression, we need to introduce a closure on the spot. 148 As a consequence, whenever we convert a ''partial'' wrapper application in an expression, we need to introduce a closure on the spot. (Simon pointed out that this is a rare case anyway.) 149 149 150 150 We do not specially handle wrappers of data constructors. They are converted just like any other toplevel function. … … 156 156 data Int = I# Int# 157 157 }}} 158 the `tyConCC` field of `Int` is set to `ConvCCInt` and we have158 we get `Int_CC = Int` and we have 159 159 {{{ 160 160 isoInt :: Int :<->: Int … … 165 165 }}} 166 166 167 As another example, the `tyConCC` field of167 As another example, 168 168 {{{ 169 169 data Maybe a = Nothing | Just a 170 170 }}} 171 has a value of `ConvCC Maybe` and we have 171 implies `Maybe_CC = Maybe` and 172 172 {{{ 173 173 isoMaybe :: (a :<->: a_CC) -> (Maybe a :<->: Maybe a_CC) … … 183 183 === Converting classes and instances === 184 184 185 We don't alter class and instance declarations in any way. However, the dictionary type constructors and dfuns are processed in the same way as other data types and value bindings, respectively; i.e., they get a `StatusCC` field and we generate converted versions and conversion constructors as usual.185 We don't alter class and instance declarations in any way. However, the dictionary type constructors and dfuns are converted in the same way as other data types and value bindings, respectively. 186 186 187 187 As an example, assume `Num Int` were defined as … … 211 211 negate_CC :: a :-> a 212 212 } 213 dNumInt_CC :: Num_CC Int -- Int \equiv Int_CC213 dNumInt_CC :: Num_CC Int -- as Int_CC = Int 214 214 dNumInt_CC = Num_CC 215 215 (to isoIntToIntToInt primAddInt)
