ANN: precis-0.3.1 - Cabal package diff tool

Hello all I've upload precis to Hackage - a diff tool for Cabal packages. It compares two cabal files looking at changes to the exposed and internal modules lists, then diffs the exposed modules. It only works on extant .hs files - i.e. it won't work on .hsc files. Also, I haven't tested if it works on .lhs files - parsing is left to haskell-src-exts. When it diffs new and old revisions of an exposed module it should report: - changes to the export list - changes to instance declarations - changes to exported data declarations - changes to the exported type signatures of exported functions The report it produces is not very pretty. A declaration is marked as *conflict* if its textual representation has changed - I compare the string output from pretty printing the new and old versions rather than look deeply into the AST. Though low-tech, this seems to work well in practice. I expect there are some bugs... Thanks to Malcolm Wallace for CppHs, and Niklas Broberg for haskell-src-exts. Best wishes Stephen

On Thu, 29 Apr 2010, Stephen Tetley wrote:
I've upload precis to Hackage - a diff tool for Cabal packages.
I have added a note to: https://www.haskell.org/haskellwiki/Package_versioning_policy

Hi Henning Thanks. I'm open to suggests for prettifying the output, or adding further comparisons. While coding precis, I decided that trying to police version numbers would be impractical so I decided to focus on changes/diffs instead. By the way - on the Package version policy page, Section 2 (Version Numbers) takes a lot of reading to make sense of (and I'm notionally a native English speaker). Maybe item 3 should state that "D" increases rather than the nebulus "other version components". http://www.haskell.org/haskellwiki/Package_versioning_policy Best wishes Stephen

On Wed, 5 May 2010, Stephen Tetley wrote:
I'm open to suggests for prettifying the output, or adding further comparisons. While coding precis, I decided that trying to police version numbers would be impractical so I decided to focus on changes/diffs instead.
Sure, but it helps to get an approximation of the necessary version bumps, right?
By the way - on the Package version policy page, Section 2 (Version Numbers) takes a lot of reading to make sense of (and I'm notionally a native English speaker). Maybe item 3 should state that "D" increases rather than the nebulus "other version components".
http://www.haskell.org/haskellwiki/Package_versioning_policy
I have not written the body of that page. Since it is a wiki feel free to improve whatever you think must be improved. Regards, Henning

On 5 May 2010 12:14, Henning Thielemann
On Wed, 5 May 2010, Stephen Tetley wrote:
I'm open to suggests for prettifying the output, or adding further comparisons. While coding precis, I decided that trying to police version numbers would be impractical so I decided to focus on changes/diffs instead.
Sure, but it helps to get an approximation of the necessary version bumps, right?
Hi Henning I've uploaded a new release to Hackage. The new version will generate a HTML report when supplied with an --out= command line flag and print a manageable summary to the console. Here's the console summary between 0.3.1 and 0.4.0 (unfortunately I can't host the HTML output publicly). $ precis --out=precis.html precis-0.4.0/precis.cabal precis-0.3.1/precis.cabal Comparing precis 0.4.0 to precis 0.3.1... 2 exposed modules removed 21 export list items removed 1 datatype removed 13 type signatures removed Generating a HTML report seems obvious in retrospect, as the previous version was producing far too much information to be useful. The reporting in this version could do with some more work improve its clarity, but I hope 0.4.0 is now a useful tool, rather than a curio (which 0.3.1 was). Best wishes Stephen

Hi Stephen,
precis reports parse errors when applied to packages containing Unicode syntax.
Regards,
Bas
On Thu, May 13, 2010 at 2:25 PM, Stephen Tetley
On 5 May 2010 12:14, Henning Thielemann
wrote: On Wed, 5 May 2010, Stephen Tetley wrote:
I'm open to suggests for prettifying the output, or adding further comparisons. While coding precis, I decided that trying to police version numbers would be impractical so I decided to focus on changes/diffs instead.
Sure, but it helps to get an approximation of the necessary version bumps, right?
Hi Henning
I've uploaded a new release to Hackage.
The new version will generate a HTML report when supplied with an --out= command line flag and print a manageable summary to the console. Here's the console summary between 0.3.1 and 0.4.0 (unfortunately I can't host the HTML output publicly).
$ precis --out=precis.html precis-0.4.0/precis.cabal precis-0.3.1/precis.cabal Comparing precis 0.4.0 to precis 0.3.1... 2 exposed modules removed 21 export list items removed 1 datatype removed 13 type signatures removed
Generating a HTML report seems obvious in retrospect, as the previous version was producing far too much information to be useful. The reporting in this version could do with some more work improve its clarity, but I hope 0.4.0 is now a useful tool, rather than a curio (which 0.3.1 was).
Best wishes
Stephen _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

On 13 May 2010 14:24, Bas van Dijk
Hi Stephen,
precis reports parse errors when applied to packages containing Unicode syntax.
Regards,
Bas
Hi Bas I'm not entirely surprised... Do you know if haskell-src-exts can parse files with Unicode syntax (and I'm not using enough extensions)? Thanks Stephen

On Thu, May 13, 2010 at 5:23 PM, Stephen Tetley
Hi Bas
I'm not entirely surprised...
Do you know if haskell-src-exts can parse files with Unicode syntax (and I'm not using enough extensions)?
Thanks
Stephen
Last time I checked it had problems with the ∷ and ∀ characters. I reported it to Neil Mitchell (it showed up in hlint) who in turn reported it to Niklas Broberg.

Hi Roel Thanks for the information. With Precis, I wanted to make a standalone tool rather than work with GHC-API. I don't know how stable GHC-API, but I expect it to be less stable than haskell-src-exts, and as Precis is a tool to help gauge the stability of packages I want it to be stable itself. Certainly, I don't want to be committed to getting it to work with each GHC revision. The downside to this that Precis will always lack some of the power that it could get from GHC-API. Modules with inline FFI code won't parse, and evidently Unicode symbols don't parse either. Also, even after a successful parse, the analysis that Precis does is quite shallow, diffs are calculated by pretty printing the AST of the relevant constructions (module export lists, type signatures of functions/constants..., class instances, data and class declarations). Because the analysis is shallow - quite a few false positives are generated. Changing say a type alias will indicate a change, e.g. the code below will indicate a change but the change shouldn't merit a major version number change: doesFileExist :: FilePath -> IO Bool doesFileExist :: String -> IO Bool This is the reason I stop short of considering Precis a Package Version Policy checker and only report numbers of apparent changes not a conclusion drawn from them, as I think Henning suggested. From the work done to get Precis where it is, I'd wager trying to build a fully automatic PVP checker would be more effort that its usefulness would merit. Best wishes Stephen
participants (4)
-
Bas van Dijk
-
Henning Thielemann
-
Roel van Dijk
-
Stephen Tetley