PROPOSAL: Literate Haskell in markdown noation

Hello,
I think that good support for writing literate Haskell in markdown notation
would be great! Over the weekend I updated the wiki page with a fairly
detailed description of the proposal, which Trevor implemented.
What do folks think about the feature, and if we are happy with the design,
would there be objections if I merged it in?
-Iavor
On Wed, Jun 19, 2013 at 4:28 PM, Trevor Elliott
Hi All,
I've implemented support for literate markdown in a branch [1]. After doing a search on the bug tracker to see if anyone had already worked on this I came across bug #4836 [2], which details some unexpected interactions between the markdown format, unlit and CPP. Specifically, unlit attempts to keep CPP in the comment sections of a literate file, which clashes with the way that headings are defined in markdown.
The approach that I took is that when GHC is processing markdown files, it passes the -r and -# flags to unlit, causing it to remove CPP in the comment parts of the file. I've added support for .markdown and .md as source file extensions supported by GHC to be able to detect when this is necessary. CPP can still be used within code blocks, giving a path forward for the case where the file was generated by something that wishes to leave #line markers. I've documented the changes on the wiki at [3].
Does this approach sound reasonable? If so, should I attach a patch to #4836, or create a new ticket?
Thanks!
--trevor
[1] https://github.com/elliottt/**ghc/tree/literate-markdownhttps://github.com/elliottt/ghc/tree/literate-markdown [2] http://hackage.haskell.org/**trac/ghc/ticket/4836http://hackage.haskell.org/trac/ghc/ticket/4836 [3] http://hackage.haskell.org/**trac/ghc/wiki/LiterateMarkdownhttp://hackage.haskell.org/trac/ghc/wiki/LiterateMarkdown
_______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://www.haskell.org/mailman/listinfo/ghc-devs

On 2013-06-24 22:25, Iavor Diatchki wrote:
I think that good support for writing literate Haskell in markdown notation would be great! Over the weekend I updated the wiki page with a fairly detailed description of the proposal, which Trevor implemented.
What do folks think about the feature, and if we are happy with the design, would there be objections if I merged it in?
I'm all for this. Over the years, many markup languages have come up, and juggling between Mediawiki, Haddoc, HTML, Latex and what not is really unnecessary. Markdown has reached a certain de-facto standard for beefed up text files. In the context of Haskell, it's easy to type (bird tacks are pretty awful to write multiple lines fluently with if you ask me), and it doesn't look as awkward than literate Tex Haskell, being readable in text and rendered formats. David

This argument is a little tenuous in my opinion. Markdown is very
ill-specified formally speaking with many implementations (including
our beloved Pandoc) featuring various extensions. It is not really a
'standard' in the typical sense. Pandoc actually only recently
supported 'GitHub code delimiters' - as in the above patch - only as
of a year ago or so, I believe.
In fact I believe Gruber's Markdown does not even specify a way to
delimit code blocks syntactically like this. So any way you slice it,
it's pretty "not standard." As for the MD vs TeX argument, well, it's
a pretty different tool entirely.
All that said, I'd support this patch. But mostly because it doesn't
actually introduce Markdown in any way, as much as it introduces a
relatively-simple new literate-style delimiter, in essence. (There are
arguably other forms we could support too, like the simple ``` form,
but that's where the ill-specification begins to rear its head...)
Finally, before a merge, it'd be nice to get this mentioned in the
users guide, and the release notes of course (I've been trying to keep
them a little more up to date.)
On Mon, Jun 24, 2013 at 3:46 PM, David Luposchainsky
I'm all for this. Over the years, many markup languages have come up, and juggling between Mediawiki, Haddoc, HTML, Latex and what not is really unnecessary. Markdown has reached a certain de-facto standard for beefed up text files. In the context of Haskell, it's easy to type (bird tacks are pretty awful to write multiple lines fluently with if you ask me), and it doesn't look as awkward than literate Tex Haskell, being readable in text and rendered formats.
David
_______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://www.haskell.org/mailman/listinfo/ghc-devs
-- Regards, Austin - PGP: 4096R/0x91384671

I'm not against adding this to GHC, but it's trivial to have it as a separate program (see my markdown-unlit [1]). Maybe the external program is more flexible when it comes to extending/bug fixing? But if you decide to add it to GHC, then please also add test cases for the proposed code. As a side note, ```-style code block are not part of "standard" markdown. Cheers, Simon Hengel [1] http://hackage.haskell.org/package/markdown-unlit On Mon, Jun 24, 2013 at 01:25:43PM -0700, Iavor Diatchki wrote:
Hello,
I think that good support for writing literate Haskell in markdown notation would be great! Over the weekend I updated the wiki page with a fairly detailed description of the proposal, which Trevor implemented.
What do folks think about the feature, and if we are happy with the design, would there be objections if I merged it in?
-Iavor
On Wed, Jun 19, 2013 at 4:28 PM, Trevor Elliott
wrote: Hi All,
I've implemented support for literate markdown in a branch [1]. After doing a search on the bug tracker to see if anyone had already worked on this I came across bug #4836 [2], which details some unexpected interactions between the markdown format, unlit and CPP. Specifically, unlit attempts to keep CPP in the comment sections of a literate file, which clashes with the way that headings are defined in markdown.
The approach that I took is that when GHC is processing markdown files, it passes the -r and -# flags to unlit, causing it to remove CPP in the comment parts of the file. I've added support for .markdown and .md as source file extensions supported by GHC to be able to detect when this is necessary. CPP can still be used within code blocks, giving a path forward for the case where the file was generated by something that wishes to leave #line markers. I've documented the changes on the wiki at [3].
Does this approach sound reasonable? If so, should I attach a patch to #4836, or create a new ticket?
Thanks!
--trevor
[1] https://github.com/elliottt/**ghc/tree/literate-markdownhttps://github.com/elliottt/ghc/tree/literate-markdown [2] http://hackage.haskell.org/**trac/ghc/ticket/4836http://hackage.haskell.org/trac/ghc/ticket/4836 [3] http://hackage.haskell.org/**trac/ghc/wiki/LiterateMarkdownhttp://hackage.haskell.org/trac/ghc/wiki/LiterateMarkdown
_______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://www.haskell.org/mailman/listinfo/ghc-devs
_______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://www.haskell.org/mailman/listinfo/ghc-devs

I would definitely take advantage of this feature (for blog posts
mostly) if it gets merged.
+1
On Mon, Jun 24, 2013 at 1:25 PM, Iavor Diatchki
Hello,
I think that good support for writing literate Haskell in markdown notation would be great! Over the weekend I updated the wiki page with a fairly detailed description of the proposal, which Trevor implemented.
What do folks think about the feature, and if we are happy with the design, would there be objections if I merged it in?
-Iavor
On Wed, Jun 19, 2013 at 4:28 PM, Trevor Elliott
wrote: Hi All,
I've implemented support for literate markdown in a branch [1]. After doing a search on the bug tracker to see if anyone had already worked on this I came across bug #4836 [2], which details some unexpected interactions between the markdown format, unlit and CPP. Specifically, unlit attempts to keep CPP in the comment sections of a literate file, which clashes with the way that headings are defined in markdown.
The approach that I took is that when GHC is processing markdown files, it passes the -r and -# flags to unlit, causing it to remove CPP in the comment parts of the file. I've added support for .markdown and .md as source file extensions supported by GHC to be able to detect when this is necessary. CPP can still be used within code blocks, giving a path forward for the case where the file was generated by something that wishes to leave #line markers. I've documented the changes on the wiki at [3].
Does this approach sound reasonable? If so, should I attach a patch to #4836, or create a new ticket?
Thanks!
--trevor
[1] https://github.com/elliottt/ghc/tree/literate-markdown [2] http://hackage.haskell.org/trac/ghc/ticket/4836 [3] http://hackage.haskell.org/trac/ghc/wiki/LiterateMarkdown
_______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://www.haskell.org/mailman/listinfo/ghc-devs
_______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://www.haskell.org/mailman/listinfo/ghc-devs

Certainly ok with me. Thanks!
(There should be a ticket; and user-manual docs.)
Simon
From: Iavor Diatchki [mailto:iavor.diatchki@gmail.com]
Sent: 24 June 2013 21:26
To: Trevor Elliott
Cc: ghc-devs@haskell.org; Simon Peyton-Jones
Subject: PROPOSAL: Literate Haskell in markdown noation
Hello,
I think that good support for writing literate Haskell in markdown notation would be great! Over the weekend I updated the wiki page with a fairly detailed description of the proposal, which Trevor implemented.
What do folks think about the feature, and if we are happy with the design, would there be objections if I merged it in?
-Iavor
On Wed, Jun 19, 2013 at 4:28 PM, Trevor Elliott
participants (6)
-
Austin Seipp
-
David Luposchainsky
-
Iavor Diatchki
-
Jason Dagit
-
Simon Hengel
-
Simon Peyton-Jones