-
Notifications
You must be signed in to change notification settings - Fork 236
Conversation
Leaving the type families is handy, since they are legitimately part of the class declaration. Could we get semi-colons/braces around the type family, so it becomes legal Haskell? e.g.
If not, it's not too terrible, as long as there are only |
I have added braces, semicolons and some whitespace to the output so that it is both easy to parse and readable for human:
|
Currently all Haddock |
@mrhania it's great that you fixed these but could we get some basic tests to make sure it doesn't silently break again? AFAIK @ndmitchell that pretty much all the Hoogle issues are regressions because there was nothing to track changes. It can easily be the same as html-tests (i.e. diff-based) but simpler as we don't need to strip anything. |
Hmm, I haven't thought about that this way. It can be easily reverted, so if you think that change will make your work harder, tell me.
I know, I was planning to do it. I just needed to think over how to refactor common test code because |
@mrhania it's fine as it is - as long as what Haddock produces is legal Haskell and predictable then writing code to deal with it is pretty easy. The other thing that makes my life much easier is if Haddock doesn't change the Hoogle output regularly by accident, which is why I'm very keen on the tests :). |
On master. @mrhania has a branch with test improvements which will should include Hoogle tests. |
@mrhania, it looks like the tests for this are currently broken; do you suppose you could have a look? |
@bgamari I will try to look into that later today. |
Okay, so one of the reasons behind Hoogle tests failing is that there are default methods and associated types printed after the |
This kind of breakage will always happen without an intermediate type with stable print out. Not sure how much sense it makes to try and keep up on top of Outputable instances in GHC. Further, what actually caused it is half the problem: current behaviour changes output to Hoogle which means it can't be used, so it's not desired. I also ran other tests recently and that was not the only issue by the way. |
What does Hoogle use to parse these types? If it uses GHC API utilities then it shouldn't really be a problem as long as GHC is internally "sane" and both Haddock and Hoogle are compiled using the same GHC version.
I think we really need an official format specification document for the Hoogle database that clearly states what is allowed and what is not. Otherwise we can never be sure that tests are correct and up to date. I don't think it is "healthy" that I defined some new output syntax in this PR and @ndmitchell adapted Hoogle to work with it - it should be the other way around! |
Hoogle doesn't use ghc api and Neil always adapted to ever changing Haddock output. IIRC when I spoke with him he said any format would be ok so we can pick the output, we just have to establish something stable from our end. |
Well, maybe Neil is fine with adapting Hoogle to Haddock output but I still think that this is quite "unhealthy" attitude. After all, it is his tool and he should know better what information he actually cares about. And adapting generated output is far easier than making changes in the parser. I honestly fail to see any disadvantages of having a short, official specification document for the Hoogle database format. Without it if something stops working you have to figure out what is actually broken: is there a bug in the Hoogle parser, in the Haddock output or in the Haddock test suite? And if someone wants to create an alternative to Haddock (for whatever reason) he doesn't need to scavenge in the pull request discussions collecting bits of information about all the quirks in its output format. |
For what it's worth I think @mrhania has a point here. There is no harm in specifying the format. Of course, someone needs to step up to do this; @mrhania perhaps you'd be interested in picking this up? |
I'm not arguing against a format. In fact I'm highly in favour. Main point is that to implement such a thing, we have to stop relying on Outputable, at least directly. The format itself should be fairly trivial to come up with and specify (Hoogle does not need that much info), the implementation is likely the biggest chunk of work. |
This implements improvements suggested in #415 and #417.
While default methods are now removed from Hoogle output, type families are not. So, this:
will produce following output:
@ndmitchell - if you want to get rid of type families as well, let me know.