Avoid blank line separating code and comments in Bird style?
Mateusz Kowalczyk
fuuzetsu at fuuzetsu.co.uk
Tue Jan 13 13:46:13 UTC 2015
On 01/13/2015 10:28 AM, R Sidhu wrote:
> Hi
>
> This regarding GHC behaviour for literate Haskell programs in Bird
> style. GHC expects a blank line between comment[1] and code.
> Otherwise, during the literate pre-processor stage, the error
> 'unlit: Program line next to comment' is reported.
>
> While above behaviour makes sense in general, there are situations
> where one would like to place comments adjacent to code with no
> intervening blank line. For example, in documenting a declaration
> using Haddock (in standard, non-literate Haskell), as shown in
> sections 3.1
> <https://www.haskell.org/haddock/doc/html/markup.html#idm140354810917952>
> and 3.2 <http://www.haskell.org/haddock/doc/html/ch03s02.html> of the
> Haddock User Guide, no blank line
> separates comment and code.
>
> Any way to enable GHC to accept Bird style literate programs with
> no blank lines separating comment and code?
>
> [1] 'Comment' (in context of Bird style) refers to text on lines not
> beginning with '>'.
>
> Regards
> Sidhu
>
>
I don't understand the motivation here. If you want to use Haddock with
literate Haskell it has to look something like
> -- | Foo
> someCode = undefined
I believe it does not matter to GHC whether we give it
-- | Foo, no blank line
someCode = undefined
or
-- | Foo, blank line
someCode = undefined
Haddock would see both as just someCode with a comment attached.
I imagine you're suggesting that something like
Literate comment
> someCode = undefined
is allowed but your justification using Haddock doesn't make sense in
this case: ‘Literate comment’ will not be visible.
Correct me if I'm wrong on anything here, I very rarely use the .lhs .
--
Mateusz K.
More information about the Glasgow-haskell-users
mailing list