[Haskell] ANN: haskell-src-exts-1.1.0

Niklas Broberg niklas.broberg at gmail.com
Sun Jul 26 15:00:07 EDT 2009


Fellow Haskelleers,

I'm pleased to announce the release of haskell-src-exts-1.1.0,
bringing you tuple sections, comments, and a few bug fixes.

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.0:
===================

* Adds rudimentary support for retaining comments while parsing a
source document. The support currently comes in the following form:
- The module Language.Haskell.Exts.Comments defines a datatype Comment
with two constructors denoting single-line (--) and multi-line ({- -})
comments.
- The Parseable class is extended with a function 'parseWithComments
:: Parseable ast => ParseMode -> String -> ParseResult (ast,
[Comment])' which simply returns all comments as a list alongside the
AST. There are also specialised versions for the usual suspects.

Example run:

HSE> parseExpWithComments defaultParseMode "1 + {- comment -} 4 -- end\n"
ParseOk (InfixApp (Lit (Int 1)) (QVarOp (UnQual (Symbol "+"))) (Lit (Int 4)),[Mu
ltiLine (SrcLoc {srcFilename = "<unknown>.hs", srcLine = 1, srcColumn = 3}) " co
mment ",SingleLine (SrcLoc {srcFilename = "<unknown>.hs", srcLine = 1, srcColumn
 = 19}) " end"])

This first release of comment support is as seen very rudimentary, but
I'm releasing it early in the hope that people who need features tied
to this will start looking at what's there and send me comments on
what further support they would like to see and consider missing.

* Support for TupleSections: <http://hackage.haskell.org/trac/ghc/ticket/3377>

* Fixes a bug where the statements of a list comprehension were
returned in the wrong order (oops!).

* Fixes a bug where function definitions were printed incorrectly when
using PPOffsideRule - thanks to Mathieu Boespflug for the patch.

* Fixes the broken 'cabal test' - thanks to Robin Green for the entire
test runner support!


Cheers and Happy Haskelling,

/Niklas


More information about the Haskell mailing list