Proposed annotation system + dependency issue
Simon Marlow
marlowsd at gmail.com
Wed Oct 15 04:24:52 EDT 2008
Max Bolingbroke wrote:
> 2008/10/14 Ian Lynagh <igloo at earth.li>:
>> On Mon, Oct 13, 2008 at 06:06:03PM +0100, Max Bolingbroke wrote:
>>> (http://hackage.haskell.org/trac/ghc/wiki/Annotations).
>> When you say
>> {-# ANN f id 1 #-}
>> this means you are attaching (id 1) to f, right?
>>
>> I think that that syntax is very confusing. I'm not sure what I'd prefer
>> though. Maybe parentheses, analogous to those in
>> instance C (Maybe a)
>
> That's a fair point: I also don't feel entirely happy with this aspect
> of the syntax. On a syntax-related note, Tristan proposed that we use
> this syntax instead for a slightly terser annotation:
>
> {-@ f id 1 @-}
>
> (The @ is meant to be evocative of the Java syntax for annotations).
> This might be a nice addition if we envisage annotations becoming very
> common. Furthermore, at the moment I don't think we can write:
>
> --# INLINE foo
>
> Is there any reason why not? It would be quite handy to be able to say:
--# is a legal symbol in Haskell 98, so in contrast to the {-# #-} syntax
for pragmas, this could actually break existing programs. That's why
Haddock chose to use '-- |' rather than '--|'.
Not that I'd necessarily have a strong objection to doing this, just
pointing out that it's not a straightforward choice.
> --@ foo MyAnnotationConstructor
'-- @' would work, it's not stolen by Haddock currently. However, note
that this doesn't do what you want:
-- | docs for foo
-- @ f ANNOTATION
f :: ...
because the '-- @' line is part of the Haddock comment (the Haddock comment
extends until the next non-comment line).
Cheers,
Simon
More information about the Cvs-ghc
mailing list