PROPOSAL: Literate haskell and module file names

Ola! I didn't know what the most appropriate venue for this proposal was so I crossposted to haskell-prime and glasgow-haskell-users, if this isn't the right venue I welcome advice where to take this proposal. Currently the report does not specify the mapping between filenames and module names (this is an issue in itself, it essentially makes writing haskell code that's interoperable between compilers impossible, as you can't know what directory layout each compiler expects). I believe that a minimal specification *should* go into the report (hence, haskell-prime). However, this is a separate issue from this proposal, so please start a new thread rather than sidetracking this one :) The report only mentions that "by convention" .hs extensions imply normal haskell and .lhs literate haskell (Section 10.4). In the absence of guidance from the report GHC's convention of mapping module Foo.Bar.Baz to Foo/Bar/Baz.hs or Foo/Bar/Baz.lhs seems the only sort of standard that exists. In general this standard is nice enough, but the mapping of literate haskell is a bit inconvenient, it leaves it completelyl ambiguous what the non-haskell content of said file is, which is annoying for tool authors. Pandoc has adopted the policy of checking for further file extensions for literate haskell source, e.g. Foo.rst.lhs and Foo.md.lhs. Here .rst.lhs gets interpreted as being reStructured Text with literate haskell and .md.lhs is Markdown with literate haskell. Unfortunately GHC currently maps filenames like this to the module names Foo.rst and Foo.md, breaking anything that wants to import the module Foo. I would like to propose allowing an optional extra extension in the pandoc style for literate haskell files, mapping Foo.rst.lhs to module name Foo. This is a backwards compatible change as there is no way for Foo.rst.lhs to be a valid module in the current GHC convention. Foo.rst.lhs would map to module name "Foo.rst" but module name "Foo.rst" maps to filename "Foo/rst.hs" which is not a valid haskell module anyway as the rst is lowercase and module names have to start with an uppercase letter. Pros: - Tool authors can more easily determine non-haskell content of literate haskell files - Currently valid module names will not break - Report doesn't specify behaviour, so GHC can do whatever it likes Cons: - Someone has to implement it - ?? Discussion: 4 weeks Cheers, Merijn

Hi, Am Sonntag, den 16.03.2014, 13:56 +0100 schrieb Merijn Verstraaten:
Cons:
GHC would have to either maintain a possibly long of variants to look for ([".hs", ".lhs", ".rst.lhs", ".md.lhs", ".svg.lhs", ".docx.lhs"]), or look for "Foo.*.lhs". I’d find the latter acceptable, but it should be noted. Greetings, Joachim -- Joachim “nomeata” Breitner mail@joachim-breitner.de • http://www.joachim-breitner.de/ Jabber: nomeata@joachim-breitner.de • GPG-Key: 0x4743206C Debian Developer: nomeata@debian.org

I'd rather there be some textual finger print in the module itself that be
be used to signal the literate format. But if there's a Case to be made in
open to it I guess.
On Sunday, March 16, 2014, Joachim Breitner
Hi,
Am Sonntag, den 16.03.2014, 13:56 +0100 schrieb Merijn Verstraaten:
Cons:
GHC would have to either maintain a possibly long of variants to look for ([".hs", ".lhs", ".rst.lhs", ".md.lhs", ".svg.lhs", ".docx.lhs"]), or look for "Foo.*.lhs".
I’d find the latter acceptable, but it should be noted.
Greetings, Joachim
-- Joachim “nomeata” Breitner mail@joachim-breitner.de javascript:; • http://www.joachim-breitner.de/ Jabber: nomeata@joachim-breitner.de javascript:; • GPG-Key: 0x4743206C Debian Developer: nomeata@debian.org javascript:;

My personal approach would have been to make ghc accept "Foo.*.lhs", maintaining a list of potential file format seems arduous and error prone. Cheers, Merijn On Mar 16, 2014, at 14:13 , Joachim Breitner wrote:
Hi,
Am Sonntag, den 16.03.2014, 13:56 +0100 schrieb Merijn Verstraaten:
Cons:
GHC would have to either maintain a possibly long of variants to look for ([".hs", ".lhs", ".rst.lhs", ".md.lhs", ".svg.lhs", ".docx.lhs"]), or look for "Foo.*.lhs".
I’d find the latter acceptable, but it should be noted.
Greetings, Joachim
-- Joachim “nomeata” Breitner mail@joachim-breitner.de • http://www.joachim-breitner.de/ Jabber: nomeata@joachim-breitner.de • GPG-Key: 0x4743206C Debian Developer: nomeata@debian.org _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Idk, this behavior of doing Data.Vector.lhs seems pretty awesome. I
actually might start doing that. That ghc allows that seems pretty darn
awesome. And handy too
On Sunday, March 16, 2014, Merijn Verstraaten
My personal approach would have been to make ghc accept "Foo.*.lhs", maintaining a list of potential file format seems arduous and error prone.
Cheers, Merijn
On Mar 16, 2014, at 14:13 , Joachim Breitner wrote:
Hi,
Am Sonntag, den 16.03.2014, 13:56 +0100 schrieb Merijn Verstraaten:
Cons:
GHC would have to either maintain a possibly long of variants to look for ([".hs", ".lhs", ".rst.lhs", ".md.lhs", ".svg.lhs", ".docx.lhs"]), or look for "Foo.*.lhs".
I’d find the latter acceptable, but it should be noted.
Greetings, Joachim
-- Joachim “nomeata” Breitner mail@joachim-breitner.de javascript:; • http://www.joachim-breitner.de/ Jabber: nomeata@joachim-breitner.de javascript:; • GPG-Key: 0x4743206C Debian Developer: nomeata@debian.org javascript:; _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org javascript:; http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

The behaviour could be invoked only for lower-case parts, but that may prove problematic on case-insensitive filesystems like Windows. On 16/03/2014 13:52, Carter Schonwald wrote:
Idk, this behavior of doing Data.Vector.lhs seems pretty awesome. I actually might start doing that. That ghc allows that seems pretty darn awesome. And handy too
On Sunday, March 16, 2014, Merijn Verstraaten
mailto:merijn@inconsistent.nl> wrote: My personal approach would have been to make ghc accept "Foo.*.lhs", maintaining a list of potential file format seems arduous and error prone.
Cheers, Merijn
On Mar 16, 2014, at 14:13 , Joachim Breitner wrote: > Hi, > > Am Sonntag, den 16.03.2014, 13:56 +0100 schrieb Merijn Verstraaten: >> Cons: > > GHC would have to either maintain a possibly long of variants to look > for ([".hs", ".lhs", ".rst.lhs", ".md.lhs", ".svg.lhs", ".docx.lhs"]), > or look for "Foo.*.lhs". > > I’d find the latter acceptable, but it should be noted. > > Greetings, > Joachim > > -- > Joachim “nomeata” Breitner > mail@joachim-breitner.de javascript:; • http://www.joachim-breitner.de/ > Jabber: nomeata@joachim-breitner.de javascript:; • GPG-Key: 0x4743206C > Debian Developer: nomeata@debian.org javascript:; > _______________________________________________ > Glasgow-haskell-users mailing list > Glasgow-haskell-users@haskell.org javascript:; > http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

One problem with Foo.*.hs or even Foo.md.hs mapping to the module name
Foois that as I recall JHC will look for
Data.Vector in Data.Vector.hs as well as Data/Vector.hs
This means that on a case insensitive file system Foo.MD.hs matches both
conventions.
Do I want to block an change to GHC because of an incompatible change in
another compiler? Not sure, but I at least want to raise the issue so it
can be discussed.
Another small issue is that this means you need to actually scan the
directory rather than look for particular file names, but off my head
really I don't expect directories to be full enough for that to be a
performance problem.
-Edward
On Sun, Mar 16, 2014 at 8:56 AM, Merijn Verstraaten
Ola!
I didn't know what the most appropriate venue for this proposal was so I crossposted to haskell-prime and glasgow-haskell-users, if this isn't the right venue I welcome advice where to take this proposal.
Currently the report does not specify the mapping between filenames and module names (this is an issue in itself, it essentially makes writing haskell code that's interoperable between compilers impossible, as you can't know what directory layout each compiler expects). I believe that a minimal specification *should* go into the report (hence, haskell-prime). However, this is a separate issue from this proposal, so please start a new thread rather than sidetracking this one :)
The report only mentions that "by convention" .hs extensions imply normal haskell and .lhs literate haskell (Section 10.4). In the absence of guidance from the report GHC's convention of mapping module Foo.Bar.Baz to Foo/Bar/Baz.hs or Foo/Bar/Baz.lhs seems the only sort of standard that exists. In general this standard is nice enough, but the mapping of literate haskell is a bit inconvenient, it leaves it completelyl ambiguous what the non-haskell content of said file is, which is annoying for tool authors.
Pandoc has adopted the policy of checking for further file extensions for literate haskell source, e.g. Foo.rst.lhs and Foo.md.lhs. Here .rst.lhs gets interpreted as being reStructured Text with literate haskell and .md.lhs is Markdown with literate haskell. Unfortunately GHC currently maps filenames like this to the module names Foo.rst and Foo.md, breaking anything that wants to import the module Foo.
I would like to propose allowing an optional extra extension in the pandoc style for literate haskell files, mapping Foo.rst.lhs to module name Foo. This is a backwards compatible change as there is no way for Foo.rst.lhs to be a valid module in the current GHC convention. Foo.rst.lhs would map to module name "Foo.rst" but module name "Foo.rst" maps to filename "Foo/rst.hs" which is not a valid haskell module anyway as the rst is lowercase and module names have to start with an uppercase letter.
Pros: - Tool authors can more easily determine non-haskell content of literate haskell files - Currently valid module names will not break - Report doesn't specify behaviour, so GHC can do whatever it likes
Cons: - Someone has to implement it - ??
Discussion: 4 weeks
Cheers, Merijn
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

I agree that this could collide, see my beginning remark that I believe that the report should provide a minimal specification how to map modules to filenames and vice versa. Anyhoo, I'm not married to this specific suggestion. Carter suggested "Foo+rst.lhs" on IRC, other options would be "Foo.rst+lhs" or "Foo.lhs+rst", I don't particularly care what as long as we pick something. Patching tools to support whatever solution we pick should be trivial. Cheers, Merijn On Mar 16, 2014, at 16:41 , Edward Kmett wrote:
One problem with Foo.*.hs or even Foo.md.hs mapping to the module name Foo is that as I recall JHC will look for Data.Vector in Data.Vector.hs as well as Data/Vector.hs
This means that on a case insensitive file system Foo.MD.hs matches both conventions.
Do I want to block an change to GHC because of an incompatible change in another compiler? Not sure, but I at least want to raise the issue so it can be discussed.
Another small issue is that this means you need to actually scan the directory rather than look for particular file names, but off my head really I don't expect directories to be full enough for that to be a performance problem.
-Edward
On Sun, Mar 16, 2014 at 8:56 AM, Merijn Verstraaten
wrote: Ola! I didn't know what the most appropriate venue for this proposal was so I crossposted to haskell-prime and glasgow-haskell-users, if this isn't the right venue I welcome advice where to take this proposal.
Currently the report does not specify the mapping between filenames and module names (this is an issue in itself, it essentially makes writing haskell code that's interoperable between compilers impossible, as you can't know what directory layout each compiler expects). I believe that a minimal specification *should* go into the report (hence, haskell-prime). However, this is a separate issue from this proposal, so please start a new thread rather than sidetracking this one :)
The report only mentions that "by convention" .hs extensions imply normal haskell and .lhs literate haskell (Section 10.4). In the absence of guidance from the report GHC's convention of mapping module Foo.Bar.Baz to Foo/Bar/Baz.hs or Foo/Bar/Baz.lhs seems the only sort of standard that exists. In general this standard is nice enough, but the mapping of literate haskell is a bit inconvenient, it leaves it completelyl ambiguous what the non-haskell content of said file is, which is annoying for tool authors.
Pandoc has adopted the policy of checking for further file extensions for literate haskell source, e.g. Foo.rst.lhs and Foo.md.lhs. Here .rst.lhs gets interpreted as being reStructured Text with literate haskell and .md.lhs is Markdown with literate haskell. Unfortunately GHC currently maps filenames like this to the module names Foo.rst and Foo.md, breaking anything that wants to import the module Foo.
I would like to propose allowing an optional extra extension in the pandoc style for literate haskell files, mapping Foo.rst.lhs to module name Foo. This is a backwards compatible change as there is no way for Foo.rst.lhs to be a valid module in the current GHC convention. Foo.rst.lhs would map to module name "Foo.rst" but module name "Foo.rst" maps to filename "Foo/rst.hs" which is not a valid haskell module anyway as the rst is lowercase and module names have to start with an uppercase letter.
Pros: - Tool authors can more easily determine non-haskell content of literate haskell files - Currently valid module names will not break - Report doesn't specify behaviour, so GHC can do whatever it likes
Cons: - Someone has to implement it - ??
Discussion: 4 weeks
Cheers, Merijn
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Foo+rst.lhs does nicely dodge the collision with jhc.
How does ghc do the search now? By trying each alternative in turn?
On Sun, Mar 16, 2014 at 1:14 PM, Merijn Verstraaten
I agree that this could collide, see my beginning remark that I believe that the report should provide a minimal specification how to map modules to filenames and vice versa.
Anyhoo, I'm not married to this specific suggestion. Carter suggested "Foo+rst.lhs" on IRC, other options would be "Foo.rst+lhs" or "Foo.lhs+rst", I don't particularly care what as long as we pick something. Patching tools to support whatever solution we pick should be trivial.
Cheers, Merijn
On Mar 16, 2014, at 16:41 , Edward Kmett wrote:
One problem with Foo.*.hs or even Foo.md.hs mapping to the module name Foois that as I recall JHC will look for Data.Vector in Data.Vector.hs as well as Data/Vector.hs
This means that on a case insensitive file system Foo.MD.hs matches both conventions.
Do I want to block an change to GHC because of an incompatible change in another compiler? Not sure, but I at least want to raise the issue so it can be discussed.
Another small issue is that this means you need to actually scan the directory rather than look for particular file names, but off my head really I don't expect directories to be full enough for that to be a performance problem.
-Edward
On Sun, Mar 16, 2014 at 8:56 AM, Merijn Verstraaten < merijn@inconsistent.nl> wrote:
Ola!
I didn't know what the most appropriate venue for this proposal was so I crossposted to haskell-prime and glasgow-haskell-users, if this isn't the right venue I welcome advice where to take this proposal.
Currently the report does not specify the mapping between filenames and module names (this is an issue in itself, it essentially makes writing haskell code that's interoperable between compilers impossible, as you can't know what directory layout each compiler expects). I believe that a minimal specification *should* go into the report (hence, haskell-prime). However, this is a separate issue from this proposal, so please start a new thread rather than sidetracking this one :)
The report only mentions that "by convention" .hs extensions imply normal haskell and .lhs literate haskell (Section 10.4). In the absence of guidance from the report GHC's convention of mapping module Foo.Bar.Baz to Foo/Bar/Baz.hs or Foo/Bar/Baz.lhs seems the only sort of standard that exists. In general this standard is nice enough, but the mapping of literate haskell is a bit inconvenient, it leaves it completelyl ambiguous what the non-haskell content of said file is, which is annoying for tool authors.
Pandoc has adopted the policy of checking for further file extensions for literate haskell source, e.g. Foo.rst.lhs and Foo.md.lhs. Here .rst.lhs gets interpreted as being reStructured Text with literate haskell and .md.lhs is Markdown with literate haskell. Unfortunately GHC currently maps filenames like this to the module names Foo.rst and Foo.md, breaking anything that wants to import the module Foo.
I would like to propose allowing an optional extra extension in the pandoc style for literate haskell files, mapping Foo.rst.lhs to module name Foo. This is a backwards compatible change as there is no way for Foo.rst.lhs to be a valid module in the current GHC convention. Foo.rst.lhs would map to module name "Foo.rst" but module name "Foo.rst" maps to filename "Foo/rst.hs" which is not a valid haskell module anyway as the rst is lowercase and module names have to start with an uppercase letter.
Pros: - Tool authors can more easily determine non-haskell content of literate haskell files - Currently valid module names will not break - Report doesn't specify behaviour, so GHC can do whatever it likes
Cons: - Someone has to implement it - ??
Discussion: 4 weeks
Cheers, Merijn
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

On Mon, Mar 17, 2014 at 9:08 AM, Edward Kmett
Foo+rst.lhs does nicely dodge the collision with jhc.
Is this legal on Windows? -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net

2014-03-17 14:22 GMT+01:00 Brandon Allbery
On Mon, Mar 17, 2014 at 9:08 AM, Edward Kmett
wrote: Foo+rst.lhs does nicely dodge the collision with jhc.
Is this legal on Windows?
According to http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).as... it is, although I can't test this at the moment.

On 17/03/2014 13:08, Edward Kmett wrote:
Foo+rst.lhs does nicely dodge the collision with jhc.
How does ghc do the search now? By trying each alternative in turn?
Yes - see compiler/main/Finder.hs Cheers, Simon
On Sun, Mar 16, 2014 at 1:14 PM, Merijn Verstraaten
mailto:merijn@inconsistent.nl> wrote: I agree that this could collide, see my beginning remark that I believe that the report should provide a minimal specification how to map modules to filenames and vice versa.
Anyhoo, I'm not married to this specific suggestion. Carter suggested "Foo+rst.lhs" on IRC, other options would be "Foo.rst+lhs" or "Foo.lhs+rst", I don't particularly care what as long as we pick something. Patching tools to support whatever solution we pick should be trivial.
Cheers, Merijn
On Mar 16, 2014, at 16:41 , Edward Kmett wrote:
One problem with Foo.*.hs or even Foo.md.hs mapping to the module name Foo is that as I recall JHC will look for Data.Vector in Data.Vector.hs as well as Data/Vector.hs
This means that on a case insensitive file system Foo.MD.hs matches both conventions.
Do I want to block an change to GHC because of an incompatible change in another compiler? Not sure, but I at least want to raise the issue so it can be discussed.
Another small issue is that this means you need to actually scan the directory rather than look for particular file names, but off my head really I don't expect directories to be full enough for that to be a performance problem.
-Edward
On Sun, Mar 16, 2014 at 8:56 AM, Merijn Verstraaten
mailto:merijn@inconsistent.nl> wrote: Ola!
I didn't know what the most appropriate venue for this proposal was so I crossposted to haskell-prime and glasgow-haskell-users, if this isn't the right venue I welcome advice where to take this proposal.
Currently the report does not specify the mapping between filenames and module names (this is an issue in itself, it essentially makes writing haskell code that's interoperable between compilers impossible, as you can't know what directory layout each compiler expects). I believe that a minimal specification *should* go into the report (hence, haskell-prime). However, this is a separate issue from this proposal, so please start a new thread rather than sidetracking this one :)
The report only mentions that "by convention" .hs extensions imply normal haskell and .lhs literate haskell (Section 10.4). In the absence of guidance from the report GHC's convention of mapping module Foo.Bar.Baz to Foo/Bar/Baz.hs or Foo/Bar/Baz.lhs seems the only sort of standard that exists. In general this standard is nice enough, but the mapping of literate haskell is a bit inconvenient, it leaves it completelyl ambiguous what the non-haskell content of said file is, which is annoying for tool authors.
Pandoc has adopted the policy of checking for further file extensions for literate haskell source, e.g. Foo.rst.lhs and Foo.md.lhs. Here .rst.lhs gets interpreted as being reStructured Text with literate haskell and .md.lhs is Markdown with literate haskell. Unfortunately GHC currently maps filenames like this to the module names Foo.rst and Foo.md, breaking anything that wants to import the module Foo.
I would like to propose allowing an optional extra extension in the pandoc style for literate haskell files, mapping Foo.rst.lhs to module name Foo. This is a backwards compatible change as there is no way for Foo.rst.lhs to be a valid module in the current GHC convention. Foo.rst.lhs would map to module name "Foo.rst" but module name "Foo.rst" maps to filename "Foo/rst.hs" which is not a valid haskell module anyway as the rst is lowercase and module names have to start with an uppercase letter.
Pros: - Tool authors can more easily determine non-haskell content of literate haskell files - Currently valid module names will not break - Report doesn't specify behaviour, so GHC can do whatever it likes
Cons: - Someone has to implement it - ??
Discussion: 4 weeks
Cheers, Merijn
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org mailto:Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Can we get a little more information on what pandoc is doing? Is there a
documentation link?
In part am wondering if it is possible to have a Foo.hs.md file that pandoc
compiles down to Foo.hs with or without help from GHC.
On Sun, Mar 16, 2014 at 5:56 AM, Merijn Verstraaten
Ola!
I didn't know what the most appropriate venue for this proposal was so I crossposted to haskell-prime and glasgow-haskell-users, if this isn't the right venue I welcome advice where to take this proposal.
Currently the report does not specify the mapping between filenames and module names (this is an issue in itself, it essentially makes writing haskell code that's interoperable between compilers impossible, as you can't know what directory layout each compiler expects). I believe that a minimal specification *should* go into the report (hence, haskell-prime). However, this is a separate issue from this proposal, so please start a new thread rather than sidetracking this one :)
The report only mentions that "by convention" .hs extensions imply normal haskell and .lhs literate haskell (Section 10.4). In the absence of guidance from the report GHC's convention of mapping module Foo.Bar.Baz to Foo/Bar/Baz.hs or Foo/Bar/Baz.lhs seems the only sort of standard that exists. In general this standard is nice enough, but the mapping of literate haskell is a bit inconvenient, it leaves it completelyl ambiguous what the non-haskell content of said file is, which is annoying for tool authors.
Pandoc has adopted the policy of checking for further file extensions for literate haskell source, e.g. Foo.rst.lhs and Foo.md.lhs. Here .rst.lhs gets interpreted as being reStructured Text with literate haskell and .md.lhs is Markdown with literate haskell. Unfortunately GHC currently maps filenames like this to the module names Foo.rst and Foo.md, breaking anything that wants to import the module Foo.
I would like to propose allowing an optional extra extension in the pandoc style for literate haskell files, mapping Foo.rst.lhs to module name Foo. This is a backwards compatible change as there is no way for Foo.rst.lhs to be a valid module in the current GHC convention. Foo.rst.lhs would map to module name "Foo.rst" but module name "Foo.rst" maps to filename "Foo/rst.hs" which is not a valid haskell module anyway as the rst is lowercase and module names have to start with an uppercase letter.
Pros: - Tool authors can more easily determine non-haskell content of literate haskell files - Currently valid module names will not break - Report doesn't specify behaviour, so GHC can do whatever it likes
Cons: - Someone has to implement it - ??
Discussion: 4 weeks
Cheers, Merijn
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Ola!
I raised this proposal earlier this year and got to busy to follow up, this week I was suddenly reminded and decided to reraise this. To summarise the discussion up until this point:
There was no real opposition to the general idea, the only real objection to the original proposal was that “Foo.lhs.md” and “Foo.md.lhs” would collide with the naming scheme used by JHC on case insensitive filesystems. Alternative proposal raised during the discussion: "Foo+md.lhs", "Foo.lhs+md” and “Foo.md+lhs”.
According to MS documentation and testing the + should not be an issue on windows, the + doesn’t collide with any other haskell compiler (at least, not any I’m aware off) and since the report doesn’t specify any module name resolution mechanism, it does not conflict with the report either.
My personal preferences goes to either “.lhs+md” or “.md+lhs”, since GHC currently tries every alternative in turn, I propose to just extend this list to look for any file whose extension is “.lhs+*” or “.*+lhs”.
Are there any objections to this? If not, I’m just going to produce a patch + ticket as there were no real objections to the proposal last time.
Cheers,
Merijn
On 16 Mar 2014, at 05:56 , Merijn Verstraaten
Ola!
I didn't know what the most appropriate venue for this proposal was so I crossposted to haskell-prime and glasgow-haskell-users, if this isn't the right venue I welcome advice where to take this proposal.
Currently the report does not specify the mapping between filenames and module names (this is an issue in itself, it essentially makes writing haskell code that's interoperable between compilers impossible, as you can't know what directory layout each compiler expects). I believe that a minimal specification *should* go into the report (hence, haskell-prime). However, this is a separate issue from this proposal, so please start a new thread rather than sidetracking this one :)
The report only mentions that "by convention" .hs extensions imply normal haskell and .lhs literate haskell (Section 10.4). In the absence of guidance from the report GHC's convention of mapping module Foo.Bar.Baz to Foo/Bar/Baz.hs or Foo/Bar/Baz.lhs seems the only sort of standard that exists. In general this standard is nice enough, but the mapping of literate haskell is a bit inconvenient, it leaves it completelyl ambiguous what the non-haskell content of said file is, which is annoying for tool authors.
Pandoc has adopted the policy of checking for further file extensions for literate haskell source, e.g. Foo.rst.lhs and Foo.md.lhs. Here .rst.lhs gets interpreted as being reStructured Text with literate haskell and .md.lhs is Markdown with literate haskell. Unfortunately GHC currently maps filenames like this to the module names Foo.rst and Foo.md, breaking anything that wants to import the module Foo.
I would like to propose allowing an optional extra extension in the pandoc style for literate haskell files, mapping Foo.rst.lhs to module name Foo. This is a backwards compatible change as there is no way for Foo.rst.lhs to be a valid module in the current GHC convention. Foo.rst.lhs would map to module name "Foo.rst" but module name "Foo.rst" maps to filename "Foo/rst.hs" which is not a valid haskell module anyway as the rst is lowercase and module names have to start with an uppercase letter.
Pros: - Tool authors can more easily determine non-haskell content of literate haskell files - Currently valid module names will not break - Report doesn't specify behaviour, so GHC can do whatever it likes
Cons: - Someone has to implement it - ??
Discussion: 4 weeks
Cheers, Merijn

Dear Merijn,
Do you even need a separate extension or filename convention for this? Can't you just call it lhs and expand the definition thereof to include markdown? (I suggested something similar before, but objections were raised that having too good and too broad an unlitter might lead to the bit-rot of the flag to employ external unlitters. I didn't quite understand that objection, but didn't pursue it)
Regards,
Philip
________________________________________
Van: Glasgow-haskell-users
Ola!
I didn't know what the most appropriate venue for this proposal was so I crossposted to haskell-prime and glasgow-haskell-users, if this isn't the right venue I welcome advice where to take this proposal.
Currently the report does not specify the mapping between filenames and module names (this is an issue in itself, it essentially makes writing haskell code that's interoperable between compilers impossible, as you can't know what directory layout each compiler expects). I believe that a minimal specification *should* go into the report (hence, haskell-prime). However, this is a separate issue from this proposal, so please start a new thread rather than sidetracking this one :)
The report only mentions that "by convention" .hs extensions imply normal haskell and .lhs literate haskell (Section 10.4). In the absence of guidance from the report GHC's convention of mapping module Foo.Bar.Baz to Foo/Bar/Baz.hs or Foo/Bar/Baz.lhs seems the only sort of standard that exists. In general this standard is nice enough, but the mapping of literate haskell is a bit inconvenient, it leaves it completelyl ambiguous what the non-haskell content of said file is, which is annoying for tool authors.
Pandoc has adopted the policy of checking for further file extensions for literate haskell source, e.g. Foo.rst.lhs and Foo.md.lhs. Here .rst.lhs gets interpreted as being reStructured Text with literate haskell and .md.lhs is Markdown with literate haskell. Unfortunately GHC currently maps filenames like this to the module names Foo.rst and Foo.md, breaking anything that wants to import the module Foo.
I would like to propose allowing an optional extra extension in the pandoc style for literate haskell files, mapping Foo.rst.lhs to module name Foo. This is a backwards compatible change as there is no way for Foo.rst.lhs to be a valid module in the current GHC convention. Foo.rst.lhs would map to module name "Foo.rst" but module name "Foo.rst" maps to filename "Foo/rst.hs" which is not a valid haskell module anyway as the rst is lowercase and module names have to start with an uppercase letter.
Pros: - Tool authors can more easily determine non-haskell content of literate haskell files - Currently valid module names will not break - Report doesn't specify behaviour, so GHC can do whatever it likes
Cons: - Someone has to implement it - ??
Discussion: 4 weeks
Cheers, Merijn

Hey Philip, This proposal is not because *GHC* needs to know anything about markdown/rST, in fact, GHC is already perfectly happy to take a literate haskell files that’s written in markdown, since it just strips the non-haskell bits and only compiles the haskell code. The problem is OTHER tools. For example, I have literate haskell files for my blog posts, how does my blog software know whether my lhs file is markdown, rST, TeX, or what not? I can just name my files using anyway I want (like “Foo.md.lhs”) to have these tools detect the format, but then GHC will no longer compile my files. This is the problem I’m trying to solve with this proposal, once we settle on some extension format like this, it’s trivial to patch (for example) pandoc to use this to detect which contents are in the file. Cheers, Merijn On 16 Aug 2014, at 06:51 , p.k.f.holzenspies@utwente.nl wrote:
Dear Merijn,
Do you even need a separate extension or filename convention for this? Can't you just call it lhs and expand the definition thereof to include markdown? (I suggested something similar before, but objections were raised that having too good and too broad an unlitter might lead to the bit-rot of the flag to employ external unlitters. I didn't quite understand that objection, but didn't pursue it)
Regards, Philip
________________________________________ Van: Glasgow-haskell-users
namens Merijn Verstraaten Verzonden: zaterdag 16 augustus 2014 00:40 Aan: haskell-prime@haskell.org; glasgow-haskell-users@haskell.org Onderwerp: Revival: PROPOSAL: Literate haskell and module file names Ola!
I raised this proposal earlier this year and got to busy to follow up, this week I was suddenly reminded and decided to reraise this. To summarise the discussion up until this point:
There was no real opposition to the general idea, the only real objection to the original proposal was that “Foo.lhs.md” and “Foo.md.lhs” would collide with the naming scheme used by JHC on case insensitive filesystems. Alternative proposal raised during the discussion: "Foo+md.lhs", "Foo.lhs+md” and “Foo.md+lhs”.
According to MS documentation and testing the + should not be an issue on windows, the + doesn’t collide with any other haskell compiler (at least, not any I’m aware off) and since the report doesn’t specify any module name resolution mechanism, it does not conflict with the report either.
My personal preferences goes to either “.lhs+md” or “.md+lhs”, since GHC currently tries every alternative in turn, I propose to just extend this list to look for any file whose extension is “.lhs+*” or “.*+lhs”.
Are there any objections to this? If not, I’m just going to produce a patch + ticket as there were no real objections to the proposal last time.
Cheers, Merijn
On 16 Mar 2014, at 05:56 , Merijn Verstraaten
wrote: Ola!
I didn't know what the most appropriate venue for this proposal was so I crossposted to haskell-prime and glasgow-haskell-users, if this isn't the right venue I welcome advice where to take this proposal.
Currently the report does not specify the mapping between filenames and module names (this is an issue in itself, it essentially makes writing haskell code that's interoperable between compilers impossible, as you can't know what directory layout each compiler expects). I believe that a minimal specification *should* go into the report (hence, haskell-prime). However, this is a separate issue from this proposal, so please start a new thread rather than sidetracking this one :)
The report only mentions that "by convention" .hs extensions imply normal haskell and .lhs literate haskell (Section 10.4). In the absence of guidance from the report GHC's convention of mapping module Foo.Bar.Baz to Foo/Bar/Baz.hs or Foo/Bar/Baz.lhs seems the only sort of standard that exists. In general this standard is nice enough, but the mapping of literate haskell is a bit inconvenient, it leaves it completelyl ambiguous what the non-haskell content of said file is, which is annoying for tool authors.
Pandoc has adopted the policy of checking for further file extensions for literate haskell source, e.g. Foo.rst.lhs and Foo.md.lhs. Here .rst.lhs gets interpreted as being reStructured Text with literate haskell and .md.lhs is Markdown with literate haskell. Unfortunately GHC currently maps filenames like this to the module names Foo.rst and Foo.md, breaking anything that wants to import the module Foo.
I would like to propose allowing an optional extra extension in the pandoc style for literate haskell files, mapping Foo.rst.lhs to module name Foo. This is a backwards compatible change as there is no way for Foo.rst.lhs to be a valid module in the current GHC convention. Foo.rst.lhs would map to module name "Foo.rst" but module name "Foo.rst" maps to filename "Foo/rst.hs" which is not a valid haskell module anyway as the rst is lowercase and module names have to start with an uppercase letter.
Pros: - Tool authors can more easily determine non-haskell content of literate haskell files - Currently valid module names will not break - Report doesn't specify behaviour, so GHC can do whatever it likes
Cons: - Someone has to implement it - ??
Discussion: 4 weeks
Cheers, Merijn

i personally think the .format+lhs pattern/convention is a good one, and
prevents any misinterpretations that current plague literate tools + willl
be treated as an unknown format rather than eagerly as .format or .lhs
On Sat, Aug 16, 2014 at 5:05 PM, Merijn Verstraaten
Hey Philip,
This proposal is not because *GHC* needs to know anything about markdown/rST, in fact, GHC is already perfectly happy to take a literate haskell files that’s written in markdown, since it just strips the non-haskell bits and only compiles the haskell code.
The problem is OTHER tools. For example, I have literate haskell files for my blog posts, how does my blog software know whether my lhs file is markdown, rST, TeX, or what not? I can just name my files using anyway I want (like “Foo.md.lhs”) to have these tools detect the format, but then GHC will no longer compile my files.
This is the problem I’m trying to solve with this proposal, once we settle on some extension format like this, it’s trivial to patch (for example) pandoc to use this to detect which contents are in the file.
Cheers, Merijn
Dear Merijn,
Do you even need a separate extension or filename convention for this? Can't you just call it lhs and expand the definition thereof to include markdown? (I suggested something similar before, but objections were raised
On 16 Aug 2014, at 06:51 , p.k.f.holzenspies@utwente.nl wrote: that having too good and too broad an unlitter might lead to the bit-rot of the flag to employ external unlitters. I didn't quite understand that objection, but didn't pursue it)
Regards, Philip
________________________________________ Van: Glasgow-haskell-users
Verzonden: zaterdag 16 augustus 2014 00:40 Aan: haskell-prime@haskell.org; glasgow-haskell-users@haskell.org Onderwerp: Revival: PROPOSAL: Literate haskell and module file names
Ola!
I raised this proposal earlier this year and got to busy to follow up,
namens Merijn Verstraaten
this week I was suddenly reminded and decided to reraise this. To summarise the discussion up until this point: There was no real opposition to the general idea, the only real
objection to the original proposal was that “Foo.lhs.md” and “Foo.md.lhs” would collide with the naming scheme used by JHC on case insensitive filesystems. Alternative proposal raised during the discussion: "Foo+md.lhs", "Foo.lhs+md” and “Foo.md+lhs”.
According to MS documentation and testing the + should not be an issue
on windows, the + doesn’t collide with any other haskell compiler (at least, not any I’m aware off) and since the report doesn’t specify any module name resolution mechanism, it does not conflict with the report either.
My personal preferences goes to either “.lhs+md” or “.md+lhs”, since GHC
currently tries every alternative in turn, I propose to just extend this list to look for any file whose extension is “.lhs+*” or “.*+lhs”.
Are there any objections to this? If not, I’m just going to produce a
patch + ticket as there were no real objections to the proposal last time.
Cheers, Merijn
On 16 Mar 2014, at 05:56 , Merijn Verstraaten
Ola!
I didn't know what the most appropriate venue for this proposal was so I crossposted to haskell-prime and glasgow-haskell-users, if this isn't the right venue I welcome advice where to take this proposal.
Currently the report does not specify the mapping between filenames and module names (this is an issue in itself, it essentially makes writing haskell code that's interoperable between compilers impossible, as you can't know what directory layout each compiler expects). I believe that a minimal specification *should* go into the report (hence, haskell-prime). However, this is a separate issue from this proposal, so please start a new
The report only mentions that "by convention" .hs extensions imply
normal haskell and .lhs literate haskell (Section 10.4). In the absence of guidance from the report GHC's convention of mapping module Foo.Bar.Baz to Foo/Bar/Baz.hs or Foo/Bar/Baz.lhs seems the only sort of standard that exists. In general this standard is nice enough, but the mapping of
Pandoc has adopted the policy of checking for further file extensions
for literate haskell source, e.g. Foo.rst.lhs and Foo.md.lhs. Here .rst.lhs gets interpreted as being reStructured Text with literate haskell and .md.lhs is Markdown with literate haskell. Unfortunately GHC currently maps filenames like this to the module names Foo.rst and Foo.md, breaking anything that wants to import the module Foo.
I would like to propose allowing an optional extra extension in the
Pros: - Tool authors can more easily determine non-haskell content of
wrote: thread rather than sidetracking this one :) literate haskell is a bit inconvenient, it leaves it completelyl ambiguous what the non-haskell content of said file is, which is annoying for tool authors. pandoc style for literate haskell files, mapping Foo.rst.lhs to module name Foo. This is a backwards compatible change as there is no way for Foo.rst.lhs to be a valid module in the current GHC convention. Foo.rst.lhs would map to module name "Foo.rst" but module name "Foo.rst" maps to filename "Foo/rst.hs" which is not a valid haskell module anyway as the rst is lowercase and module names have to start with an uppercase letter. literate haskell files
- Currently valid module names will not break - Report doesn't specify behaviour, so GHC can do whatever it likes
Cons: - Someone has to implement it - ??
Discussion: 4 weeks
Cheers, Merijn
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Right, given the lack of disagreement and past support for this I will implement whichever variant is simplest to implement/strikes my fancy and put a patch up on Trac.
Cheers,
Merijn
On 16 Aug 2014, at 14:23 , Carter Schonwald
i personally think the .format+lhs pattern/convention is a good one, and prevents any misinterpretations that current plague literate tools + willl be treated as an unknown format rather than eagerly as .format or .lhs
On Sat, Aug 16, 2014 at 5:05 PM, Merijn Verstraaten
wrote: Hey Philip, This proposal is not because *GHC* needs to know anything about markdown/rST, in fact, GHC is already perfectly happy to take a literate haskell files that’s written in markdown, since it just strips the non-haskell bits and only compiles the haskell code.
The problem is OTHER tools. For example, I have literate haskell files for my blog posts, how does my blog software know whether my lhs file is markdown, rST, TeX, or what not? I can just name my files using anyway I want (like “Foo.md.lhs”) to have these tools detect the format, but then GHC will no longer compile my files.
This is the problem I’m trying to solve with this proposal, once we settle on some extension format like this, it’s trivial to patch (for example) pandoc to use this to detect which contents are in the file.
Cheers, Merijn
On 16 Aug 2014, at 06:51 , p.k.f.holzenspies@utwente.nl wrote:
Dear Merijn,
Do you even need a separate extension or filename convention for this? Can't you just call it lhs and expand the definition thereof to include markdown? (I suggested something similar before, but objections were raised that having too good and too broad an unlitter might lead to the bit-rot of the flag to employ external unlitters. I didn't quite understand that objection, but didn't pursue it)
Regards, Philip
________________________________________ Van: Glasgow-haskell-users
namens Merijn Verstraaten Verzonden: zaterdag 16 augustus 2014 00:40 Aan: haskell-prime@haskell.org; glasgow-haskell-users@haskell.org Onderwerp: Revival: PROPOSAL: Literate haskell and module file names Ola!
I raised this proposal earlier this year and got to busy to follow up, this week I was suddenly reminded and decided to reraise this. To summarise the discussion up until this point:
There was no real opposition to the general idea, the only real objection to the original proposal was that “Foo.lhs.md” and “Foo.md.lhs” would collide with the naming scheme used by JHC on case insensitive filesystems. Alternative proposal raised during the discussion: "Foo+md.lhs", "Foo.lhs+md” and “Foo.md+lhs”.
According to MS documentation and testing the + should not be an issue on windows, the + doesn’t collide with any other haskell compiler (at least, not any I’m aware off) and since the report doesn’t specify any module name resolution mechanism, it does not conflict with the report either.
My personal preferences goes to either “.lhs+md” or “.md+lhs”, since GHC currently tries every alternative in turn, I propose to just extend this list to look for any file whose extension is “.lhs+*” or “.*+lhs”.
Are there any objections to this? If not, I’m just going to produce a patch + ticket as there were no real objections to the proposal last time.
Cheers, Merijn
On 16 Mar 2014, at 05:56 , Merijn Verstraaten
wrote: Ola!
I didn't know what the most appropriate venue for this proposal was so I crossposted to haskell-prime and glasgow-haskell-users, if this isn't the right venue I welcome advice where to take this proposal.
Currently the report does not specify the mapping between filenames and module names (this is an issue in itself, it essentially makes writing haskell code that's interoperable between compilers impossible, as you can't know what directory layout each compiler expects). I believe that a minimal specification *should* go into the report (hence, haskell-prime). However, this is a separate issue from this proposal, so please start a new thread rather than sidetracking this one :)
The report only mentions that "by convention" .hs extensions imply normal haskell and .lhs literate haskell (Section 10.4). In the absence of guidance from the report GHC's convention of mapping module Foo.Bar.Baz to Foo/Bar/Baz.hs or Foo/Bar/Baz.lhs seems the only sort of standard that exists. In general this standard is nice enough, but the mapping of literate haskell is a bit inconvenient, it leaves it completelyl ambiguous what the non-haskell content of said file is, which is annoying for tool authors.
Pandoc has adopted the policy of checking for further file extensions for literate haskell source, e.g. Foo.rst.lhs and Foo.md.lhs. Here .rst.lhs gets interpreted as being reStructured Text with literate haskell and .md.lhs is Markdown with literate haskell. Unfortunately GHC currently maps filenames like this to the module names Foo.rst and Foo.md, breaking anything that wants to import the module Foo.
I would like to propose allowing an optional extra extension in the pandoc style for literate haskell files, mapping Foo.rst.lhs to module name Foo. This is a backwards compatible change as there is no way for Foo.rst.lhs to be a valid module in the current GHC convention. Foo.rst.lhs would map to module name "Foo.rst" but module name "Foo.rst" maps to filename "Foo/rst.hs" which is not a valid haskell module anyway as the rst is lowercase and module names have to start with an uppercase letter.
Pros: - Tool authors can more easily determine non-haskell content of literate haskell files - Currently valid module names will not break - Report doesn't specify behaviour, so GHC can do whatever it likes
Cons: - Someone has to implement it - ??
Discussion: 4 weeks
Cheers, Merijn
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
participants (10)
-
Brandon Allbery
-
Carter Schonwald
-
Edward Kmett
-
Ganesh Sittampalam
-
Greg Weber
-
Joachim Breitner
-
Merijn Verstraaten
-
p.k.f.holzenspies@utwente.nl
-
Simon Marlow
-
Sven Panne