[Haskell-cafe] ANN: haskell-src-exts-1.1.4

John A. De Goes john at n-brain.net
Thu Sep 3 18:05:13 EDT 2009

Roundtrip is an important milestone for automated refactoring tools.  
Nice work!


John A. De Goes
N-Brain, Inc.
The Evolution of Collaboration

http://www.n-brain.net    |    877-376-2724 x 101

On Sep 3, 2009, at 2:57 PM, Niklas Broberg wrote:

> Fellow Haskelleers,
> I'm pleased to announce the release of haskell-src-exts-1.1.4!
> * On hackage: http://hackage.haskell.org/package/haskell-src-exts
> * Via cabal: cabal install haskell-src-exts
> * Via darcs: darcs get http://code.haskell.org/haskell-src-exts
> * Report bugs: http://trac.haskell.org/haskell-src-exts
> haskell-src-exts is a package for Haskell source code manipulation. In
> particular it defines an abstract syntax tree representation, and a
> parser and pretty-printer to convert between this representation and
> String. It handles (almost) all syntactic extensions to the Haskell 98
> standard implemented by GHC, and the parsing can be parametrised on
> what extensions to recognise.
> haskell-src-exts-1.1.4 follows version 1.1.3 in being a mostly
> experimental release. From a PVP perspective, the version number
> indicates that no incompatible changes have been made to the *stable*
> portion of the package, i.e. anything that doesn't contain Annotated
> in its module name. The experimental stuff in
> Language.Haskell.Annotated{.*} has changed quite a lot, but those of
> you who depend on it already must obviously know what you're doing.
> ;-)
> haskell-src-exts-1.1.4:
> ===================
> * For the stable part, the only new thing in haskell-src-exts-1.1.4 is
> a bug fix that allows declaration headers surrounded by parentheses to
> be parsed, e.g. "data (a :< b) = ...".
> * For the experimental part, the new and cool feature is a full
> exact-printer, allowing full round-tripping of parsing plus printing.
> In other words, using the parser and the exact-printer in conjunction
> gives the same result back: exactPrint . parse == id . (Well, that's
> half a lie since you need to use parseWithComments and some uncurrying
> if you want to so easily compose, but that's the gist of it anyway.
> :-))
> * There have also been a number of further changes to the (annotated)
> AST to allow it to retain enough source information to allow for said
> exact-printing. In particular there have been changes to the way
> contexts and declaration heads are treated, and literals have been
> embellished to remember just how they were given (e.g. did we use 0xFF
> or 255? \BEL or \a?).
> * With a few small caveats, the round-tripping works over the full
> (alas somewhat small) test suite that comes with (the darcs version
> of) haskell-src-exts:
>  - Trailing whitespace on a line is not retained. (The test suite
> uses reverse . dropWhile (isSpace) . reverse on each line to disregard
> that issue.)
>  - Tab characters in the source are converted to (8) spaces (except
> when they appear inside comments or literals). (The test suite doesn't
> contain tabs.)
>  - Exact specification of literals is only remembered for literals
> used as literals :-). What I mean is, source literals appearing in
> other positions in the source than as Haskell literals will be
> converted to a basic form. E.g. 'infixl 0x02 %%' will become 'infixl 2
> %%'. Apart from infix declarations (tell me you never considered
> writing them that way!) this mostly matters for various pragmas.
>  - Parentheses used around the function symbol in a function
> declaration will not be remembered (I can't figure out how to make a
> non-outrageous change to the AST to cope with them). E.g. '(foo a) b =
> ...' will be printed as 'foo a b = ...'. If anyone has an idea for a
> neat (or at least non-outrageous) AST fix that could handle these
> cases, drop me a line.
>  - Literate source files are not handled by the exact-printer (can't
> re-literate them).
> Please, help me test this on your source code! If you grab a darcs
> version of the package from the repository, you can put any and all
> source files you want to test in the "haskell-src-exts/Test/examples"
> directory and then just run 'cabal test'. Please report any failing
> cases to my trac! :-)
> Cheers and Happy Haskelling,
> /Niklas
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list