Changes between Version 12 and Version 13 of CrossPackageDocumentation
- Timestamp:
- 05/28/09 09:50:28 (4 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
CrossPackageDocumentation
v12 v13 25 25 We might not need to store anything in the .haddock files if we can reconstruct all declarations from the `TyThings` available in the .hi files. We already convert instances using a conversion function `toHsType :: Type -> HsType Name`. We could try to write a conversation function `toHsDecl :: TyThing -> HsDecl Name`. 26 26 27 Apparently, it might also be possible to do the conversion using existing Template Haskell functionality. This needs looking into.27 It might also be possible to do the conversion using existing Template Haskell functionality in GHC. Template Haskell lets you `reify` an identify, which returns the abstract syntax of its declaration (or type). Internally to GHC, the implementation of `reify` turns a `TyThing` into a `TH.Dec`. There is also functionality in Template Haskell that turns `TH.Dec` into `HsSyn`, for compilation by GHC (see `hsSyn/Convert.lhs`). Hence, in theory we have all the bits to get from `TyThing` to `HsSyn` already in GHC, we just have to connect them up. 28 28 29 29 The downside of this approach is that we lose the original declaration style. For example, we don't know if a data type was declared using GADT-style syntax (with a 'where' clause), or normal style. Other examples:
