id	summary	reporter	owner	description	type	status	priority	milestone	version	resolution	keywords	cc
10	Parsing module without explicit module declaration fails	waern	SimonHengel	"If a module does not contain an explicit module declaration
'''and''' starts with
{{{
-- | some comment
}}}
then parsing fails.

This is a bug in GHC's parser.  It is only triggered if
[http://www.haskell.org/ghc/docs/latest/html/libraries/ghc/DynFlags.html#v:Opt_Haddock Opt_Haddock] is used.

=== Details ===
GHC's parser has a rule for Haddock comments on module headers.
When the parser sees the Haddock comment at the
beginning it then wants the next declaration to be a module header
(the grammar has an S/R conflict because of this).

One possible solution could be to parse Haddock comments separately from the Haskell code, and match up Haddock comments with AST nodes in a later step.

=== Steps to reproduce ===
{{{
-- | Hi there
main = print ""Hello World!""
}}}

Running
{{{
$ haddock Main.hs
}}}
fails with:
{{{
Main.hs:2:1: parse error on input `main'
}}}

In contrast both of the following example work just fine:

{{{
{-
Hi there
-}
main = print ""Hello World!""
}}}
{{{
foo = 23
-- | Hi there
main = print ""Hello World!""
}}}"	defect	assigned	major	_|_				
