Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems when a directory field contains a dot #119

Closed
yamadapc opened this issue Aug 12, 2016 · 2 comments
Closed

Problems when a directory field contains a dot #119

yamadapc opened this issue Aug 12, 2016 · 2 comments

Comments

@yamadapc
Copy link

yamadapc commented Aug 12, 2016

When a field that takes a directory contains a dot, hpack's renderer will generate a line with nothing but a . in it. However, this is invalid in a cabal file, as dots on their single lines are meant to express empty-lines (I think, I can't find the documentation the source that does it is here).

A simple example of the bug is here: https://gist.github.com/0cc7f8f8e2cbc9ee7bbf82876a822e28

In there, source-dirs: . generates an invalid cabal file. Though this specific case isn't super common, without specifying source-dirs: ., hpack won't include the other-modules section for the modules in the current directory (I'd consider that another ticket).


My idea for a fix would be to output:

field: .
  , other-value
  , other-value

Whenever . is a value.

yamadapc added a commit to yamadapc/hpack-convert that referenced this issue Aug 12, 2016
This closes sol#119. By pulling dots to the same line as the field name.

For example:

    source-dirs:
    - .
    - something

Will render as:

    hs-source-dirs: .
                 , something

Or

    hs-source-dirs: .,
                   something

Depending on the comma configuration. Likewise:

    include-dirs:
    - .
    - something

Will render as:

    include-dirs: .
          something
@soenkehahn
Copy link
Collaborator

Another solution might be to replace . with ./..

@yamadapc
Copy link
Author

Mm... Yeah, that could be a much cleaner solution.

yamadapc added a commit to yamadapc/hpack-convert that referenced this issue Aug 21, 2016
This closes sol#119, by replacing `.` with `./.` as suggested by
@soenkehahn.

For example:

    source-dirs:
    - .

Will render as:

    hs-source-dirs:
                   ./.

This supersedes sol#120.
yamadapc added a commit to yamadapc/hpack-convert that referenced this issue Aug 24, 2016
@sol sol closed this as completed in ab32238 Sep 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants