29 | | Note that basic types, such as `Int` and friends, would have `tyConCC` set to `Nothing`, which is exactly what we want. |
| 26 | Moreover, 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 | |
| 30 | 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: |
| 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)`. |
| 36 | Note that basic types, such as `Int` and friends, should have `tyConCC` set to `AsIsCC`. |