Cross-package documentation going well!

A good deal of success! Here is the current status of my loose edges… Plus I’m sure there are some inevitable syntax niceties (choosing when to display in GADT syntax for example), but using this approach, they can’t be perfect, only pretty-good. (The approach is similar to going through Template Haskell except we found out that TH/Convert had some problems, such as producing RdrNames rather than Names, so I wrote the equivalent function to go directly from TyThing to HsDecl Name). So:(tyThingToHsSyn :: TyThing -> LHsDecl Name) is done (except probably for a few corner cases) — it compiles and works! (under 6.11.something and 6.10.3; I just failed to install ghc-paths for 6.8.2[*]) Paste of my working module here:http://hpaste.org/6717

Important remaining corner cases include:
– It seems that TyCon needs to export a new function (tyConParent :: TyCon -> TyConParent), because there’s no way to get that info presently!
– (isFunTyCon tc || isPrimTyCon tc) : how the heck am I supposed to represent these in a TyClDecl? :-)
– When the HsDecls tree contains something of type HsDoc, do I just leave it empty? Will Haddock-code need to / already does fill that in? I guess I’ll find that out once I test my code on more things…? or what?
– it looks like I neglected to implement class ATs yet.

Also, (parseName “Prelude.->”) crashed GHC with “isDataOcc: check me ->”, so I wasn’t able to test it yet :-) … or is it one of those syntaxes that’s so fixed that you’re not even allowed to export or import it, perhaps?

***

Also I succeeded at integrating it into Haddock. Well, almost. For module List, I have the English documentation being displayed where it should be, and I have the signature displayed: all the signatures are “() -> ()”, :-P . I still need to finish threading the Ghc monad through Haddock.Interface.Create so that I can call lookupName at the right times.
– foible: I needed to convert InstalledInterface’s (HsDoc DocName) to ExportDecl’s (HsDoc Name), so I had to essentially write fmap for HsDoc, because it’s lamely not an instance of class Functor. Where should that fmap-code be put? (can it be derived yet?)
– In Haddock.Interface.Create:
-* Under what circumstances is (Map.lookup (nameModule t) instIfaceMap) == Nothing? Is it if we haddock a package for which its dependencies are compiled, but not, themselves, haddocked?
-* I didn’t figure out where to get ExportDecl’s expItemInstances from (but I didn’t really look around for it yet)

okay that’s enough for the day! I need some sleep! And some feedback would be good. Besides that, I do have a plan: Integrate the two pieces I just did; Test on lots more examples than just haskell98-List; fix the things that I obviously neglected; Make the code a bit more presentable. Any big pieces I’m leaving out that we have to do before starting to integrate my code? (well, hoping that there aren’t any more big unexpected things that break along the way, anyway)