Changes between Version 13 and Version 14 of CrossPackageDocumentation

Show
Ignore:
Timestamp:
05/28/09 10:18:04 (5 years ago)
Author:
waern (IP: 82.150.248.28)
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • CrossPackageDocumentation

    v13 v14  
    2525We 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`. 
    2626 
    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. 
     27It might also be possible to do the conversion using existing Template Haskell functionality in GHC.  Template Haskell lets you `reify` an identifier, 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. 
    2828 
    2929The 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: