Module Name Plugin: Treat modules starting with lowercase as Main module#616
Conversation
|
@konn thanks for the improvement. Is a main module the unique case where a module can start with lower case? @tittoassini please, could you take a look? |
Well, strictly speaking, it could be different if it is specified with ghc option like At least, module names starting with a lowercase are rejected hence we should either provide a common default name for them or just stopping suggesting module names for them. |
The module header is optional for them, right? So it could be an alternative. However this pr is a improvement over the actual situation so imo it could be merged and only switch to a more defensive option if there is concrete real issues about. |
jneira
left a comment
There was a problem hiding this comment.
LGTM, will merge soon if @tittoassini cant take a final look
|
Sorry for the delay in answering, the change seems perfectly legit to me. (Un)related question: Most of the changes in the commit are 'noise' due to differences in the formatting of the import statements. Is there a project-wide standard for formatting? |
I am afraid it is not. It is a somewhat tricky question, as afaik almost each dev has a favourite formatting flavour 😝 But personally i am not very strict about, as this pr demonstrates 😄 |
Currently, module name plugin treats basename of file as module name.
This inferes, for example, the module name of
app/exe01.hsasexe01, contrary to the expectation that they must beMain.This pull-requests addresses this issue by defaulting to
Mainwhen the file name is starting with non-upper cases.Perhaps, the logic itself can be refined so that it infers it
Mainonly when the lowercased file is located right after the source-dirs?