RE: [Haskell-cafe] Haddock and literate Haskell: annotations must bemarked as source?

2009-09-25 Thread Bayley, Alistair
> From: haskell-cafe-boun...@haskell.org 
> [mailto:haskell-cafe-boun...@haskell.org] On Behalf Of Andy Gimblett
> Sent: 24 September 2009 20:19
> 
> On 24 Sep 2009, at 20:10, Duncan Coutts wrote:
> 
> > On Thu, 2009-09-24 at 19:48 +0100, Andy Gimblett wrote:
> >
> >> That's great news for me, except: that's what I tried 
> first, and I've
> >> just tried it again and it still doesn't seem to work for me.   
> >> Perhaps
> >> I am doing something wrong...?
> >
> > You're quite right, it got broken with the move to haddock2. The  
> > code in
> > Cabal-1.6 skips the pre-processing when using haddock2, assuming  
> > haddock
> > will handle it. In the current Cabal development version it works
> > properly and I get the right output for your example.
> 
> Ah, righto.  In that case, I won't shy away from LHS, and I'll be  
> patient for the next Cabal release, or maybe even check out the  
> development version.  :-)


Doh. I forgot that little detail. You need cabal > 1.6.0.2, which unfortunately 
is the last released version. The current development one should do it (very 
easy to install with cabal :-).

Alistair
*
Confidentiality Note: The information contained in this message,
and any attachments, may contain confidential and/or privileged
material. It is intended solely for the person(s) or entity to
which it is addressed. Any review, retransmission, dissemination,
or taking of any action in reliance upon this information by
persons or entities other than the intended recipient(s) is
prohibited. If you received this in error, please contact the
sender and delete the material from any computer.
*

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


RE: [Haskell-cafe] Haddock and literate Haskell: annotations must bemarked as source?

2009-09-24 Thread Bayley, Alistair
> From: haskell-cafe-boun...@haskell.org 
> [mailto:haskell-cafe-boun...@haskell.org] On Behalf Of Andy Gimblett
> 
> It seems to me that Haddock only picks up annotation comments (ie  
> those that should be included in the produced documentation) from  
> literate Haskell source when those annotations are themselves marked  
> up as source - it seems not to recognise them in the general text.
> 
> It appears the literate  
> version needs to look like this:
> 
>  > -- | Turn a foo into a bar
>  > foo :: Foo -> Bar
>  > foo b = ...
> 
> which to my mind rather defeats the purpose of being literate.
> 
> So: am I right that this is the intended/expected behaviour?  


Haddock currently uses ghc's parser, and I believe the literate preprocessor 
discards comments. I think there is an item on the haddock wishlist to preserve 
the literate comments, but I'm not certain...

This problem has been solved in cabal, BTW. Cabal preprocesses .lhs itself, 
rather than trust the compiler to do it, and it preserves the comments. If you 
generate you haddocks with cabal, then you should be able to use the markup the 
way you expected.

The Takusen source files are written in this style. For example, see:
 http://darcs.haskell.org/takusen/Database/Enumerator.lhs

Alistair
*
Confidentiality Note: The information contained in this message,
and any attachments, may contain confidential and/or privileged
material. It is intended solely for the person(s) or entity to
which it is addressed. Any review, retransmission, dissemination,
or taking of any action in reliance upon this information by
persons or entities other than the intended recipient(s) is
prohibited. If you received this in error, please contact the
sender and delete the material from any computer.
*

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe