[Haskell-cafe] Re: [Haskell] Re: ANN: Haddock version 2.1.0

David Waern david.waern at gmail.com
Fri May 9 07:26:48 EDT 2008

2008/5/9 Simon Marlow <simonmarhaskell at gmail.com>:
> David Waern wrote:
>> 2008/5/8 Simon Marlow <marlowsd at gmail.com>:
>>> So basically you want to run a lexer over the source again to collect all
>>> the comments?
>> Yes.
>>> You really want to use GHC's lexer, because otherwise you
>>> have to write another lexer.
>> I don't mind writing a lexer that just collects the comments. It
>> should be simpler than a full Haskell lexer, right? It wouldn't need
>> to handle layout, for instance. Using GHC is also a good option.
> I'm not sure it's that much easier to write a lexer that just collects
> comments.  For example, is there a comment here?
>  3#--foo
> with -XMagicHash it is (3# followed by a comment), but without -XMagicHash
> it is not (3 followed by the operator #--).  You have to implement a
> significant chunk of the options that GHC supports to get it right.  I'd say
> its probably easier to work with GHC's lexer.

Ah, I didn't think about the GHC options that change the lexical
syntax. You're right, using the GHC lexer should be easier.


More information about the Haskell-Cafe mailing list